Document layout and layers/Grid typesetting
Contents
Introduction
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.
Example
\setuplayout [grid=yes, width=12cm] \definefont [BigFont] [Bold at 20pt] [24pt] \setuphead [section] [style=\BigFont] \showgrid \starttext \startsection [title=Lorem ipsum dolor] \input ward \stopsection \startsection [title=Lorem ipsum dolor sit amet consectetur adipisicing elit] \input ward \stopsection \stoptext
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.
Example
% macros=mkvi \setuplayout [grid=yes] \definefont [BigFont] [Bold at 20pt] [24pt] \unprotect \newdimen\section_frame_width \unexpanded\def\section_command#number#title{% \section_frame_width\hsize % we need to calculate the remaining \setbox\scratchbox\hbox{#number\space} % horizontal space \advance\section_frame_width by -\wd\scratchbox #number\space \framed [ width=\section_frame_width, before=, location=top, align=right,]{#title}% } \setuphead [section] [ style=\BigFont, after=, before={\blank[2*line]}, command=\section_command, ] \protect \showgrid \starttext \startsection [title=Lorem ipsum dolor] \input ward \stopsection \dorecurse{4}{% \startsection [title=Lorem ipsum dolor sit amet consectetur adipisicing elit] \input ward \stopsection} \stoptext
Typesetting non grid aligned content
See the page design chapter of the new reference manual!
You can wrap that whole stuff inside
\startlinecorrection ... \stoplinecorrection
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) |