Hi, I know I asked the question a few years ago, but I don't remember ! The idea is to test whether the document contains only one page or not. If it contains only one page, the header is enabled. If it contains several pages, the header is enabled only on the first page but not on the others. Thanks Fabrice
Hi,
On 26 Aug 2021, at 16:07, Fabrice Couvreur via ntg-context
wrote: Hi, I know I asked the question a few years ago, but I don't remember ! The idea is to test whether the document contains only one page or not.
Perhaps not the nicest solution, but this works: \doifvalueelse {\lastpage} {1} {\message{true}} {\message{false}}
If it contains only one page, the header is enabled. If it contains several pages, the header is enabled only on the first page but not on the others. Thanks Fabrice ___________________________________________________________________________________ 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 ___________________________________________________________________________________
— Taco Hoekwater E: taco@bittext.nl genderfluid (all pronouns)
Taco Hoekwater via ntg-context schrieb am 26.08.2021 um 16:34:
Hi,
On 26 Aug 2021, at 16:07, Fabrice Couvreur via ntg-context
wrote: Hi, I know I asked the question a few years ago, but I don't remember ! The idea is to test whether the document contains only one page or not.
Perhaps not the nicest solution, but this works:
\doifvalueelse {\lastpage} {1} {\message{true}} {\message{false}}
Same solution but better counter name: \doifelse{\totalnumberofpages}{1}{...}{...} Wolfgang
Hi, Using this (but it's not exactly what I want) it works test-1.tex %%%%%%%%%%%%%% \setuppagenumbering [alternative=doublesided,location=] \definelayout [1] [header=10mm] \setuplayout [header=0pt, height=middle] \setupbackgrounds [header] [text] [frame=off,bottomframe=on, framecolor=lightgray,rulethickness=1pt] \starttext \dorecurse{5}{\samplefile{lorem}} %\dorecurse{1}{\samplefile{lorem}} \stoptext %%%%%%%%%%%%%%%%%%ù Using this (almost what I'm trying to do) without success test-2.tex %%%%%%%%%%%%% \setuppagenumbering [alternative=doublesided,location=] \setupbackgrounds [header] [text] [frame=off,bottomframe=on, framecolor=lightgray,rulethickness=1pt] \startsetups[header] \doifelse{\totalnumberofpages}{1} {\setupheadertexts[\setups{header}]} {} \stopsetups \starttext \dorecurse{5}{\samplefile{lorem}} %\dorecurse{1}{\samplefile[lorem]r} \stoptext %%%%%%%%%%%%%%%%%%% Fabrice Le jeu. 26 août 2021 à 17:56, Wolfgang Schuster via ntg-context < ntg-context@ntg.nl> a écrit :
Taco Hoekwater via ntg-context schrieb am 26.08.2021 um 16:34:
Hi,
On 26 Aug 2021, at 16:07, Fabrice Couvreur via ntg-context <
ntg-context@ntg.nl> wrote:
Hi, I know I asked the question a few years ago, but I don't remember ! The idea is to test whether the document contains only one page or not.
Perhaps not the nicest solution, but this works:
\doifvalueelse {\lastpage} {1} {\message{true}} {\message{false}}
Same solution but better counter name:
\doifelse{\totalnumberofpages}{1}{...}{...}
Wolfgang
___________________________________________________________________________________ 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
___________________________________________________________________________________
Fabrice Couvreur via ntg-context schrieb am 26.08.2021 um 19:06:
Hi,
Using this (almost what I'm trying to do) without success
[...]
\startsetups[header] \doifelse{\totalnumberofpages}{1} {\setupheadertexts[\setups{header}]} {} \stopsetups
This stores the page check in the setups environment but you never call it. The call from within the environment itself can't work because the content is never evaluated and even if it would be called you create an endless loop. Wolfgang
participants (3)
-
Fabrice Couvreur
-
Taco Hoekwater
-
Wolfgang Schuster