Grid typesetting

From Wiki
Revision as of 03:17, 10 October 2020 by Adityam (talk | contribs) (→‎Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Grid typesetting ensures the same vertical position of typeset lines:

  • in case of multiple columns it ensures the same vertical position of adjacent lines
  • in case of duplex printing it ensures the same vertical position of lines on front and back side of the page. This approach prevents disturbing the reader by dark tint between the lines if the medium is translucent.

Enable grid typesetting

Grid typesetting is enabled with \setuplayout [grid=yes] and visualized with \showgrid.

Alternative grid snapping methods are discussed in the description of \setuplayout, and also in snaptogrid (to merge ?)

Placing titles on the grid

As title font sizes and baseline distances differ from the body text, only the last baseline is placed on the grid. The baseline distance of preceding lines (in case of multi-line titles) is not affected by the grid settings.


\setuplayout [grid=yes, width=12cm]
\definefont  [BigFont]  [Bold at 20pt] [24pt]
\setuphead   [section]  [style=\BigFont]


  \startsection [title=Lorem ipsum dolor]
    \input ward

  \startsection [title=Lorem ipsum dolor sit amet consectetur adipisicing elit]
    \input ward


Adjusting the section head placement

Lots of examples and the commands and options for head placement are provided in the manual It's in the details!. However, it is not covered how to place the first line of a multi-line structure head onto the grid. The solution is to frame the structure head and instruct to typeset the first line on the grid.


% macros=mkvi
\setuplayout [grid=yes]
\definefont  [BigFont]  [Bold at 20pt] [24pt]

  \section_frame_width\hsize             % we need to calculate the remaining
  \setbox\scratchbox\hbox{#number\space} % horizontal space
  \advance\section_frame_width by -\wd\scratchbox
  \framed [

\setuphead [section] [

  \startsection [title=Lorem ipsum dolor]
    \input ward

    \startsection [title=Lorem ipsum dolor sit amet consectetur adipisicing elit]
      \input ward

Typesetting non grid aligned content

See the page design chapter of the new reference manual!

You can wrap that whole stuff inside


The stuff inside that environment will not be grid-aligned, but the final resulting box will be.

TODO: this page is too short (See: To-Do List)