<TeXmacs|1.0.7.18>

<style|tmdoc>

<\body>
  <tmdoc-title|Page layout>

  In this section, we describe how <TeXmacs> fills pages with typesetted
  content. Besides specifying the settings on how to print a document, the
  user may also determine the way pages should be rendered on screen. It
  should be noticed that the number of environment variables is redundant in
  the sense that some variables are computed as a function of other ones. For
  instance, by default, the paragraph width is computed as a function of the
  page size and the left and right margins.

  <paragraph*|Paper specific variables>

  <\explain>
    <var-val|page-type|a4><explain-synopsis|the size of pages>
  <|explain>
    Specify the size of a page when printing out. Most standard formats are
    available in <menu|Document|Page|Size>. By default, the paper size is the
    one of your printer (the default printer settings may be changed in
    <menu|Edit|Preferences|Printer>). When the <src-var|page-type> is set to
    <verbatim|user>, then the page size is given by <src-var|page-width> and
    <src-var|page-height>.
  </explain>

  <\explain>
    <var-val|page-orientation|portrait><explain-synopsis|page orientation>
  <|explain>
    The orientation of pages can be either <verbatim|portrait> or
    <verbatim|landscape>.
  </explain>

  <\explain>
    <var-val|page-nr|0><explain-synopsis|current page number>
  <|explain>
    The current page number. This environment variable should be manipulated
    with care, since it is not yet available at typesetting time. For a
    reliable determination of page numbers, one may combine the
    <markup|label> and <markup|page-ref> primitives. Nevertheless, the
    <src-var|page-nr> variable can be used in the macros which render page
    headers and footers.
  </explain>

  <\explain>
    <src-var|page-the-page><explain-synopsis|display the page number>
  <|explain>
    This environment variable really contains the macro which is used for
    rendering the page-number. By default, it renders <src-var|page-nr>. The
    macro takes no arguments. In order to simulate a document whose first
    page number is <math|123>, one may redefine

    <\tm-fragment>
      <inactive*|<assign|page-the-page|<macro|<plus|<value|page-nr>|122>>>>
    </tm-fragment>
  </explain>

  <\explain>
    <var-val|page-breaking|optimal><explain-synopsis|page breaking algorithm>
  <|explain>
    This parameter specifies the page breaking algorithm. The default
    <verbatim|optimal> algorithm takes into account the global document and
    tries hard to avoid bad page breaks. The alternative <verbatim|sloppy>
    algorithm uses a fast first-fit algorithm, but produces bad page break
    with a higher probability. The <verbatim|medium> quality algorithm is the
    same as the <verbatim|optimal> algorithm, except for two column content.
  </explain>

  <\explain>
    <var-val|page-flexibility|1.0><explain-synopsis|flexibility for
    stretching>
  <|explain>
    This parameter specifies how much stretchable spaces may be extended or
    reduced in order to fill pages which are too short or too long. A page
    flexibility of <math|1> allows spaces to be stretched to their minimal
    and maximal values. A page flexibility of <math|0> prevents spaces to be
    stretched. For other values of <src-var|page-flexibility> the behaviour
    is linear.
  </explain>

  <\explain>
    <var-val|page-shrink|1fn><explain-synopsis|allowed amount of page
    shrinking>
  <|explain>
    In the case when it is very hard to find good page breaks, this parameter
    specifies an additional amount of space by which a page is allowed to be
    reduced.
  </explain>

  <\explain>
    <var-val|page-extend|0fn><explain-synopsis|allowed amount of page
    extensions>
  <|explain>
    In the case when it is very hard to find good page breaks, this parameter
    specifies an additional amount of space by which a page is allowed to be
    extended.
  </explain>

  <paragraph*|Screen specific variables>

  <\explain>
    <var-val|page-medium|papyrus><explain-synopsis|the page medium>
  <|explain>
    This environment variable, which is initialized using
    <menu|Document|Page|Type>, specifies how pages are rendered on the
    screen. The following values are available:

    <\description>
      <item*|<verbatim|paper>>Page breaks are visually indicated on the
      screen. This mode is useful for ajusting the final version of a
      document before printing or sending it to a publisher. However, the use
      of this mode slows down the editor since every modification in the
      document triggers the page-breaking algorithm.

      Notice also that the mere selection of this mode does not imply the
      screen margins and page decorations to be as on paper. In order to
      previsualize a document in a fully realistic way, you should also set
      <menu|Document|Page|Screen margins|Show header and footer> and
      <menu|Document|Page|Screen margins|Margins as on paper>.

      <item*|<verbatim|papyrus>>The paragraph width is the same as on paper,
      but page breaking is disabled. This mode is most useful during the
      editing phase of a document which will ultimately be printed out. It
      combines a reasonable editing speed with realistic line breaks.

      <item*|<verbatim|automatic>>The paragraph width is as large as possible
      so as to fit into the current window and page breaking is disabled.
      This setting, which makes optimal use of the available space on your
      screen, is useful for documents which are not intended to be printed
      out. It may for instance be selected when using <TeXmacs> as a browser
      or as an interface to computer algebra systems.
    </description>
  </explain>

  <\explain>
    <var-val|page-screen-width|10cm><explain-synopsis|width of the rendering
    window>
  <|explain>
    In <verbatim|automatic> mode, this environement variable contains the
    width of the screen.
  </explain>

  <\explain>
    <var-val|page-screen-height|10cm><explain-synopsis|height of the
    rendering window>
  <|explain>
    In <verbatim|automatic> mode, this environement variable contains the
    height of the screen.
  </explain>

  <\explain>
    <var-val|page-screen-margin|true><explain-synopsis|special margins for
    screen editing?>
  <|explain>
    This flag specifies whether the screen margins are manually specified by
    the user, or whether they are the same as on paper.
  </explain>

  <\explain>
    <var-val|page-screen-left|5mm>

    <var-val|page-screen-right|5mm>

    <var-val|page-screen-top|15mm>

    <var-val|page-screen-bot|15mm><explain-synopsis|left margin on screen>
  <|explain>
    When <src-var|page-screen-margin> is <verbatim|true>, then these
    environment variables determine the margins which are to be used for
    rendering on the screen.
  </explain>

  <\explain>
    <var-val|page-show-hf|false><explain-synopsis|show headers and footers on
    screen?>
  <|explain>
    This flag determines whether the page headers and footers should be
    visible on the screen. When set to <verbatim|true>, it should be noticed
    that the headers and footers are not always correctly updated when
    editing. In the case when you suspect them to be wrong, refreshing the
    display by scrolling down and up should display the correct values.
  </explain>

  <paragraph*|Specifying the margins>

  The parameters for page margins are represented schematically at the left
  hand side in figure <no-break><reference|tm-page-fig>. One may either
  specify the paragraph width as a function of the left and right margins, or
  <em|vice versa>. The left and right margins may depend on whether the page
  number is odd or even.

  <\explain>
    <var-val|page-width-margin|false>

    <var-val|page-height-margin|false><explain-synopsis|compute margins from
    main text dimensions?>
  <|explain>
    When <src-var|page-width-margin> is set to <verbatim|false>, then the
    paragraph width <src-var|par-width> is determined automatically from the
    page size and the left and right margins. When set to <verbatim|true>,
    the left and right margins are determined as a function of the page size,
    the paragraph width, <src-var|page-odd-shift> and
    <src-var|page-even-shift>. For compatability with <TeX>/<LaTeX>, it is
    also possible to set <src-var|page-width-margin> to <verbatim|tex>, in
    which case the horizontal margins are determined from <src-var|page-odd>,
    <src-var|page-even> and <src-var|par-width>. The
    <src-var|page-height-margin> variable plays a similar role for the
    vertical margins.
  </explain>

  <\explain>
    <var-val|page-width|auto>

    <var-val|page-height|auto><explain-synopsis|page width>
  <|explain>
    By default, the width and height of a page are automatically determined
    from the page type. When <src-var|page-type> is set to <verbatim|user>,
    then the user may manually specify the page size using
    <src-var|page-width> and <src-var|page-height>.
  </explain>

  <\explain>
    <var-val|page-odd|auto>

    <var-val|page-even|auto><explain-synopsis|left margin>
  <|explain>
    If <src-var|page-width-margin> is set to <verbatim|false>, then
    <src-var|page-odd> and <src-var|page-even> specify the left margins for
    odd and even pages. If <src-var|page-width-margin> is <verbatim|true>,
    then these values are computed as a function of the page size, the
    paragraph width, <src-var|page-odd-shift> and <src-var|page-even-shift>.
    When <src-var|page-odd> and <src-var|page-even> are set to
    <verbatim|auto>, then a nice default left margin is determined as a
    function of the specified page type.
  </explain>

  <\explain>
    <var-val|page-right|auto><explain-synopsis|right margin>
  <|explain>
    If <src-var|page-width-margin> is set to <verbatim|false>, then
    <src-var|page-right> specifies the right margin for odd pages. The right
    margin for even pages is given by the formula

    <\equation*>
      <text|<src-var|page-right>>+<text|<src-var|page-even>>-<text|<src-var|page-odd>>
    </equation*>

    If <src-var|page-width-margin> is <verbatim|true> or when
    <src-var|page-right> is set to <verbatim|auto>, then the right margin is
    determined in a similar way as the left margin.
  </explain>

  <\explain>
    <var-val|page-odd-shift|0mm>

    <var-val|page-even-shift|0mm><explain-synopsis|margin shifts>
  <|explain>
    If <src-var|page-width-margin> is set to <verbatim|true>, then the left
    margins for odd and even pages are determined from the page size,
    paragraph width and the margin shifts using the formulas

    <\eqnarray*>
      <tformat|<table|<row|<cell|<text|<src-var|page-even>>>|<cell|=>|<cell|<frac|<text|<src-var|page-width>>-<text|<src-var|par-width>>|2>+<text|<src-var|page-odd-shift>>>>|<row|<cell|<text|<src-var|page-odd>>>|<cell|=>|<cell|<frac|<text|<src-var|page-width>>-<text|<src-var|par-width>>|2>+<text|<src-var|page-even-shift>>>>>>
    </eqnarray*>

    The right margin is always taken to be such that the paragraph width and
    the left and right margins sum up to the page width.
  </explain>

  <\quote-env>
    <\big-figure|<image|<tuple|<#[encoded data, 47252 characters]>|ps>|0.5w|0.5h||>>
      <label|tm-page-fig>Schematic representation of the layout of pages. On
      the left hand side, the parameters <math|l>, <math|r>, <math|t> and
      <math|b> respectively correspond to the left, right, top and bottom
      margins, and <math|w> corresponds to the paragraph width. On the right
      hand side, <math|h>, <math|f>, <math|d> and <math|m> correspond to the
      header, footer, footnote and marginal note separations, <math|w> to the
      width of marginal notes, and <math|l> to the length of the footnote
      bar.
    </big-figure>
  </quote-env>

  <paragraph*|Page decorations>

  <\explain>
    <label|header-footer-env><var-val|page-odd-header|>

    <var-val|page-odd-footer|>

    <var-val|page-even-header|>

    <var-val|page-even-footer|><explain-synopsis|header for odd pages>
  <|explain>
    These environment variables contain the header and footer texts for odd
    and even pages.
  </explain>

  <\explain>
    <var-val|page-head-sep|8mm>

    <var-val|page-foot-sep|8mm><explain-synopsis|separation between
    headers/fotters and text>
  <|explain>
    These parameters determine the space between the main text and page
    headers and footers. They correspond to the <math|h> and <math|f>
    distances at the right hand side of figure <reference|tm-page-fig>.
  </explain>

  <\explain>
    <var-val|page-fnote-sep|1.0fn><explain-synopsis|space between footnotes
    and text>
  <|explain>
    The separation between the main text and footnotes, <abbr|i.e.> the
    distance <math|d> in figure <reference|tm-page-fig>.
  </explain>

  <\explain>
    <var-val|page-fnote-barlen|7.5fn><explain-synopsis|length of footnote
    bars>
  <|explain>
    The length of the foornote bar.
  </explain>

  <\explain>
    <var-val|page-float-sep|1.5fn><explain-synopsis|separation between floats
    and text>
  <|explain>
    The separation between the main text and floating objects.
  </explain>

  <\explain>
    <var-val|page-mnote-sep|5mm><explain-synopsis|separation between marginal
    notes and text>
  <|explain>
    The separation between marginal notes and the main text (not implemented
    yet).
  </explain>

  <\explain>
    <var-val|page-mnote-width|15mm><explain-synopsis|width of marginal notes>
  <|explain>
    The width of marginal notes (not implemented yet).
  </explain>

  <tmdoc-copyright|2004|Joris van der Hoeven>

  <tmdoc-license|Permission is granted to copy, distribute and/or modify this
  document under the terms of the GNU Free Documentation License, Version 1.1
  or any later version published by the Free Software Foundation; with no
  Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  Texts. A copy of the license is included in the section entitled "GNU Free
  Documentation License".>
</body>

<initial|<\collection>
</collection>>
