From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id ADA167ED52 for ; Tue, 24 Jul 2012 15:16:33 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of oandrieu@gmail.com) identity=pra; client-ip=74.125.82.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="oandrieu@gmail.com"; x-sender="oandrieu@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of oandrieu@gmail.com designates 74.125.82.182 as permitted sender) identity=mailfrom; client-ip=74.125.82.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="oandrieu@gmail.com"; x-sender="oandrieu@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-we0-f182.google.com) identity=helo; client-ip=74.125.82.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="oandrieu@gmail.com"; x-sender="postmaster@mail-we0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Am0BAKyfDlBKfVK2kGdsb2JhbABFuWIIIgEBAQEJCQ0HFAQjgiABAQEEEgIsATgBAwwBBQULDS4iEgEFARwGEyKHXAMMC5w/CQOPFIVgJw2JSAEFDIs+hnQDlUmBFIYZhwM+gVSCLA X-IronPort-AV: E=Sophos;i="4.77,646,1336341600"; d="scan'208";a="167972920" Received: from mail-we0-f182.google.com ([74.125.82.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 24 Jul 2012 15:16:33 +0200 Received: by weyx56 with SMTP id x56so7787378wey.27 for ; Tue, 24 Jul 2012 06:16:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=IpW9QEjNYg4goj8SeNMtV5ur4IMR+sRyGiVuVDlCNV8=; b=OsOXliCEV963SHR2qdQZKkvekE+S5Z/xWIU14ysKO/XSPDQWtqe1Wr3GLI4eCWmSLZ 0xP1MECvBD4AsEEvdPo02mIGtOnEtvPQgRpAeJVe1nu7g4HIRAB1VGbNS9GmJH0sMUPv eUH+WiJ7L0R/DaQLgrwYHbcuk2sPemQw0+r7f5N6iyjnxuQQpfnd4++p/qvVREtqs0zw 5cSGxHsqxG612zuxGrLfEL83P4u1huhwprJqimXNbXL3X8y+wowxrrd0TJUgW+szW0RY xWKbiwDsTRxPuHQ21/oRW4xWUanJF4BFepsbvrWFZGtyR+Hy1Ont97/LoRfudOPjwoKY aAwg== MIME-Version: 1.0 Received: by 10.180.20.99 with SMTP id m3mr6874029wie.16.1343135793091; Tue, 24 Jul 2012 06:16:33 -0700 (PDT) Sender: oandrieu@gmail.com Received: by 10.216.191.158 with HTTP; Tue, 24 Jul 2012 06:16:32 -0700 (PDT) In-Reply-To: <500D13EA.8010002@frisch.fr> References: <500D13EA.8010002@frisch.fr> Date: Tue, 24 Jul 2012 15:16:32 +0200 X-Google-Sender-Auth: R_6AX64bOvgrBJxFg2jOXFPYBKY Message-ID: From: Olivier Andrieu To: Alain Frisch Cc: caml-list Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] Understanding Format Salut, On Mon, Jul 23, 2012 at 11:05 AM, Alain Frisch wrote: > Hi all, > > I'm trying to understand the semantics of Format boxes, and I need some > help! Consider the following: > > let () = > set_margin 500; > open_vbox 0; > for _i = 1 to 300 do > open_hbox (); > print_string "x"; > close_box () > done; > close_box () > > > Format inserts line breaks, even though the page width (margin) should be > large enough to contain 300 characters (and there is no break hint anyway). > Why does it do it? Changing the value passed to set_margin does not seem > to make a difference (except for small values < 70). You have to increase the 'max_indent' parameter for the formatter too : http://caml.inria.fr/pub/docs/manual-ocaml/libref/Format.html#VALset_max_indent When you open your hbox, you get an implicit break if the current cursor position is past this max_ident. Calling set_margin does not change max_indent which keeps its default value (68). cf. this comment in format.ml : (* To indent no more than pp_max_indent, if one tries to open a block beyond pp_max_indent, then the block is rejected on the left by simulating a break. *) HTH -- Olivier