ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	denis.maier@ub.unibe.ch
Subject: Re: Adjusting parameters for a single page
Date: Tue, 11 May 2021 00:12:39 +0200	[thread overview]
Message-ID: <bc22bf10-d05f-4e9c-1833-c4f5aa2699b1@xs4all.nl> (raw)
In-Reply-To: <714265a719e6497998c8d92d14e7d4be@ub.unibe.ch>

On 5/10/2021 5:15 PM, denis.maier@ub.unibe.ch wrote:
> Hi everyone,
> 
> I know it is possible to make local changes by enclosing text in \start 
> \stop pairs to make local changes. Then, there are also commands that 
> only affect the next/current paragraph, such as \looseness.
> 
> But is there a similar mechanism for page-layout changes? For example 
> your penalty settings allow widows and orphans, but on one particular 
> page you want to change the penalties. Or, you use \setupalign[height], 
> but on one page you want to use \setupalign[bottom] instead. Is there a 
> way to do this ?
it works per paragraph so then you need to adapt it for a specific 
paragraph

when the par starts, the properties are stored (in lmtx it's configured 
that way); you can change properties in the middle of a paragraph but 
then you need to explicitly freeze them, as demonstrated in the examples 
below; tracing will show you all stored properties

(default tex behaviour is that the last setting counts which can be 
somewhat unexpected)

\starttext
     \tracingoutput1 \tracingonline1
     \pretolerance9000 test \pretolerance8000 test \par
     \pretolerance9000 test \pretolerance7000 \updateparagraphproperties 
test \par
     \pretolerance9000 test \pretolerance6000 
\snapshotpar\frozentolerancecode test \par
\stoptext

the log shows ...

\par[newgraf][16=1,17=1], .... pretolerance 9000, ....
\par[newgraf][16=1,17=1], .... pretolerance 7000, ....
\par[newgraf][16=1,17=1], .... pretolerance 6000, ....

now, as you probably don't want to be persistent you can group:

\def\MyHack
   {\bgroup
    \pretolerance5000
    \snapshotpar\frozentolerancecode
    \egroup}

test \MyHack test

works ok because the snapshotting applies to the current paragraph (it's 
actually described in some manual)

so, basically, you have a lot of control, all together some 36 
parameters (pablo probably loves the somewhat secret on the fly 
adjustspacing step, stretch and shrink tweakability)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2021-05-10 22:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 15:15 denis.maier
2021-05-10 22:12 ` Hans Hagen [this message]
2021-05-11  8:26   ` denis.maier
2021-05-11  8:29   ` denis.maier
2021-05-11  8:41     ` luigi scarso
2021-05-11  9:37       ` denis.maier

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=bc22bf10-d05f-4e9c-1833-c4f5aa2699b1@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=denis.maier@ub.unibe.ch \
    --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).