[NTG-context] \vfill shifts content off grid

Wolfgang Schuster schuster.wolfgang at gmail.com
Sun Sep 4 11:25:50 CEST 2016


> Henri Menke <mailto:henrimenke at gmail.com>
> 31. August 2016 um 19:45
> Dear list,
>
> when I use a body font size other than the standard, issuing \vfill 
> will move the content off the grid. MWE is below. How do I fix this?
>
> Cheers, Henri
>
> ---
>
> \setupbodyfont[9pt]
> \setuplayout[grid=yes]
> \showgrid
> \starttext
> Hello
>
> \vfill
>
> World
> \stoptext

You can calculate the number of lines which have to be inserted to move 
the text
to the bottom of the text. The first step for this is to put the text 
which should be
moved into a \vbox which allows paragraphs and not only short texts. 
Afterwards
you can determine how much space is left on the page and with the 
\getnoflines
command you get the number of lines for the free space.

%%%% begin example
\define\MoveToBottom
   {\par
    \dowithnextbox
      
{\scratchdimen\dimexpr\pagegoal-\pagetotal-\nextboxht-\lineheight\relax
       \getnoflines\scratchdimen
       \emptylines[\number\noflines]%
       \flushnextbox}
      \vbox}

\setuplayout[grid=yes]

\showgrid

\starttext

Hello

\MoveToBottom{World}

\page

\input knuth

\MoveToBottom{\input ward }

\stoptext
%%%% end example

Wolfgang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20160904/f747d1d9/attachment.html>


More information about the ntg-context mailing list