Changes

Jump to navigation Jump to search
3,179 bytes added ,  12:06, 20 March 2016
Clone of Working on Grid with an introduction
==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 <code>\setuplayout [grid=yes]</code> and visualized with <code>\showgrid</code>.

Alternative grid snapping methods are discussed in the description of
[[Command/setuplayout#Grid Setups|{{cmd|setuplayout|link=no}}]].

==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===

<!-- <context mode="mkiv" source="yes" text="Gives"> -->
<texcode>
\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
</texcode>
<!-- </context> -->

===Adjusting the section head placement===

Lots of examples and the commands and options for head placement are provided in the manual [http://www.pragma-ade.com/general/manuals/details.pdf 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====

<!-- <context mode="mkiv" source="yes" text="Gives"> -->
<texcode>
% macros=mkvi
\setuplayout [grid=yes]
\definefont [BigFont] [Bold at 20pt] [24pt]

\unprotect
\newdimen\section_frame_width
\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
</texcode>
<!-- </context> -->

==Typesetting non grid aligned content==

See the [http://context.aanhet.net/svn/contextman/context-reference/en/co-pagedesign.pdf page design chapter] of the new reference manual!

You can wrap that whole stuff inside

<texcode>
\startlinecorrection
...
\stoplinecorrection
</texcode>

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

{{todo|this page is too short}}

Navigation menu