ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: \vfill shifts content off grid
Date: Sun, 04 Sep 2016 11:25:50 +0200	[thread overview]
Message-ID: <57CBE89E.4030303@gmail.com> (raw)
In-Reply-To: <31131dcc-4f9b-6627-1eff-4b20ce66ea8e@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1174 bytes --]

> Henri Menke <mailto:henrimenke@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

[-- Attachment #1.2: Type: text/html, Size: 2328 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      parent reply	other threads:[~2016-09-04  9:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31 17:45 Henri Menke
2016-09-01  7:33 ` Hans Hagen
2016-09-01 11:22   ` Henri Menke
2016-09-01 11:53     ` Hans Hagen
2016-09-01 12:18       ` Henri Menke
2016-09-01 12:59         ` Hans Hagen
2016-09-04  9:25 ` Wolfgang Schuster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57CBE89E.4030303@gmail.com \
    --to=schuster.wolfgang@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).