From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/96009 Path: news.gmane.org!.POSTED!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: \vfill shifts content off grid Date: Sun, 04 Sep 2016 11:25:50 +0200 Message-ID: <57CBE89E.4030303@gmail.com> References: <31131dcc-4f9b-6627-1eff-4b20ce66ea8e@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2501712686512282862==" X-Trace: blaine.gmane.org 1472981195 24768 195.159.176.226 (4 Sep 2016 09:26:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 4 Sep 2016 09:26:35 +0000 (UTC) User-Agent: Postbox 4.0.8 (Macintosh/20151105) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Sep 04 11:26:31 2016 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bgTh8-0005u5-OK for gctc-ntg-context-518@m.gmane.org; Sun, 04 Sep 2016 11:26:30 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id CE8A716DB3; Sun, 4 Sep 2016 11:26:07 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NodiOhyfE8fD; Sun, 4 Sep 2016 11:26:07 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 26ECB16DB4; Sun, 4 Sep 2016 11:26:07 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 2CE2916DB2 for ; Sun, 4 Sep 2016 11:26:06 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pE98gQmQX57R for ; Sun, 4 Sep 2016 11:26:05 +0200 (CEST) Original-Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 69BD316DB1 for ; Sun, 4 Sep 2016 11:25:55 +0200 (CEST) Original-Received: by mail-wm0-f46.google.com with SMTP id v143so91638991wmv.0 for ; Sun, 04 Sep 2016 02:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to; bh=iPVsEXfm9LwFZxnAgbs9MPKtMhEpA7DIxf3T9F0b8PU=; b=MPBHBYrLDo2sspZ95fYR6YcKKdkruk+84rHr+Q3eGHIHB6yGs9VAMVSvO2bJYGrPpS iHidsD27Qfa3Vbm6r2PXDHSJZHXy4Iti3qwXO661/IMcRTDrFu1Ywz8uW39JWo2BLj90 lebydvI3z/YqVX8EQstU1NZdnEtn4fXVHRw9elBy8rghxONhp9WM82AAXureoeAUSdFg haJUdraHydcke+gVIaKCQ+ix2jHQv+sHiPi2qA+SILzv0ClJbiOfYeu0KAQrP/bM52KG LlQrs+gZWeP7lFlUBX33IUgkK4L6PMfq7GNHYShyL6v7IRjPvCzONO639/DU9SZIioen NM3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to; bh=iPVsEXfm9LwFZxnAgbs9MPKtMhEpA7DIxf3T9F0b8PU=; b=OLcuTSKGKO9mCUXbS71aIMIfRhxy0IsHlCRGzlXbvouwOcu+24Eou8Fp8gcN2Vjgne eSV9uj2X1Y1ux62SUwSdXoMbHMVXlBt0T1cYsSnepTJTbmJWxfz82SRBUIWj+O8foHL0 swiWryCs9QElWvRmz8B1+cZWJM8PGI08fiWB4GKweBoRgZpeRLwxFnEeRlXiYpak4k1j 342KSuWzkbORjuQT0yDEN3bDSV1P4ns3Zmd/5yp1dkn3Zs2kjHAzvQN86sccf9kQ5r0f lzDuD8Wm4M2y58RmYt5KB4LyGAbmBtc5biSOPpAiekKvMBhWmdAvpplQPE+ZY6ee9g3R y8Hw== X-Gm-Message-State: AE9vXwO6Hn4beAgZZPv224hgJ03Eju5Wk7p1DLc4k4WKOA5e32PHTchIWfBdIXvucnA8FA== X-Received: by 10.28.170.72 with SMTP id t69mr10082026wme.115.1472981154872; Sun, 04 Sep 2016 02:25:54 -0700 (PDT) Original-Received: from keima.localdomain (x2f24a85.dyn.telefonica.de. [2.242.74.133]) by smtp.gmail.com with ESMTPSA id hk4sm12577100wjb.16.2016.09.04.02.25.53 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Sep 2016 02:25:54 -0700 (PDT) In-Reply-To: <31131dcc-4f9b-6627-1eff-4b20ce66ea8e@gmail.com> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:96009 Archived-At: This is a multi-part message in MIME format. --===============2501712686512282862== Content-Type: multipart/alternative; boundary="------------030704070409000108050404" This is a multi-part message in MIME format. --------------030704070409000108050404 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit > Henri Menke > 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 --------------030704070409000108050404 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
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
--------------030704070409000108050404-- --===============2501712686512282862== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============2501712686512282862==--