From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/112610 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Fabrice Couvreur via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Test for displaying a header Date: Thu, 26 Aug 2021 19:06:35 +0200 Message-ID: References: <40A5A4E3-D83B-49CC-86C0-E402899F7B47@bittext.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6028858545863654214==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4130"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Fabrice Couvreur To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Aug 26 19:09:26 2021 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mJIsY-0000qd-43 for gctc-ntg-context-518@m.gmane-mx.org; Thu, 26 Aug 2021 19:09:26 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id DD1AE286CA5; Thu, 26 Aug 2021 19:08:48 +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 kFe_oNBAHKF1; Thu, 26 Aug 2021 19:08:45 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 39BB5286D39; Thu, 26 Aug 2021 19:08:45 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id CE65F286D37 for ; Thu, 26 Aug 2021 19:08:43 +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 50fo3TyA_8P6 for ; Thu, 26 Aug 2021 19:08:41 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.167.179; helo=mail-oi1-f179.google.com; envelope-from=fabrice1.couvreur@gmail.com; receiver= Original-Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 6BB54286CA5 for ; Thu, 26 Aug 2021 19:08:41 +0200 (CEST) Original-Received: by mail-oi1-f179.google.com with SMTP id y128so5568721oie.4 for ; Thu, 26 Aug 2021 10:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=z8xoz4cm33cZJcE30QdVYhyvJVSsAJHYLep3jgKU+mA=; b=rJIhmvSjLFLAaly3S2GgNRLnJ7W9g34ob1ACVKtSZ4KOg/1zSeuGO00MqQVe0TZUfM Js4AIJmLIoGLsgv8kJ5Z+RkMo2ynbN3VI+K68n8yHcVxxTXQg4zqanEKe/XL8phbE1lV 3NcYAJMe5q5Ka1HQLIXulvXDPNU0POlcilkiNAokfkXG8zt7XY5W45z8AMJCpys1+7qR IHaOQsJnvtugwbV8QMRKWwEDebFBuh/Wmp3C3ZhaDxb8lZIAaaP5pLaCYgL32UWjCgTR NFrDjmofmZgLkG+wXwdjgyFtpb9VYc6lZkXXIhmqvCrUJhtUt/JZgluFtVhwtFuTulJ6 agtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=z8xoz4cm33cZJcE30QdVYhyvJVSsAJHYLep3jgKU+mA=; b=PZZDthZy/1/0AyT0m3GQmieQPP7klJBjf10cIsxzttHhk/pt97oYjPKEk+3Z6z2wDf kQ2VRFQHwyponnyIRkrIJN0dGdS3S9e5ZgekvukCftpjQXCShoosJLR7V94K2VBbJ1sm pW03RCNSM0lwL+zr8C85zJe+q/ATySvCFowxoiwVqrHocXGZ2mD81McCSZxz07gkt3db i5X30DtxBGvV+TZkw8VChwJ4yTtNgNjWkjN2xrasyoiI5BNH15UgQJlZygPJgS9x1RiP prbwwEIHeKnL6thnCxHDJAp7G5Hbi/T7feqK5L7xPCS5J6tRiVFttjnzH3LVZZvkqUM4 XjpA== X-Gm-Message-State: AOAM531BY+DwODpUHz90P2PMjhyTcf3WhoV4oxDTFnnw+EdryrGCic+Q Ve3VNobYHougcW4vz/pfqtCHMvoAr5LuwvIllLxSfk3ek3U= X-Google-Smtp-Source: ABdhPJwOR+4BHhdnkcgIxdaezNqEnd3z3p/eK5XmLgAnJtnwyReVcgVSdL2wwlA6HmWTFaGLslJrPpQyr9Obf7V0RnY= X-Received: by 2002:aca:ad55:: with SMTP id w82mr3343819oie.45.1629997719571; Thu, 26 Aug 2021 10:08:39 -0700 (PDT) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 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.io gmane.comp.tex.context:112610 Archived-At: --===============6028858545863654214== Content-Type: multipart/alternative; boundary="0000000000000f4f9005ca796b15" --0000000000000f4f9005ca796b15 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, Using this (but it's not exactly what I want) it works test-1.tex %%%%%%%%%%%%%% \setuppagenumbering [alternative=3Ddoublesided,location=3D] \definelayout [1] [header=3D10mm] \setuplayout [header=3D0pt, height=3Dmiddle] \setupbackgrounds [header] [text] [frame=3Doff,bottomframe=3Don, framecolor=3Dlightgray,rulethickness=3D1pt] \starttext \dorecurse{5}{\samplefile{lorem}} %\dorecurse{1}{\samplefile{lorem}} \stoptext %%%%%%%%%%%%%%%%%%=C3=B9 Using this (almost what I'm trying to do) without success test-2.tex %%%%%%%%%%%%% \setuppagenumbering [alternative=3Ddoublesided,location=3D] \setupbackgrounds [header] [text] [frame=3Doff,bottomframe=3Don, framecolor=3Dlightgray,rulethickness=3D1pt] \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=C3=BBt 2021 =C3=A0 17:56, Wolfgang Schuster via ntg-context < ntg-context@ntg.nl> a =C3=A9crit : > 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 > > _________________________________________________________________________= __________ > --0000000000000f4f9005ca796b15 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,
Using this (but it's not exactly what I want) it works<= /span>

te= st-1.tex %%%%%%%%%%%%%%

\setuppagenumbering
=C2=A0 [alternative=3Ddoublesi= ded,location=3D]

\definelayout
=C2=A0 [1]
=C2=A0 [header=3D10m= m]

\setuplayout
=C2=A0 [header=3D0pt,
=C2=A0 =C2=A0height=3Dmi= ddle]

\setupbackgrounds
=C2=A0 =C2=A0[header]
=C2=A0 =C2=A0[te= xt]
=C2=A0 =C2=A0[frame=3Doff,bottomframe=3Don,
=C2=A0 =C2=A0 =C2=A0f= ramecolor=3Dlightgray,rulethickness=3D1pt]


\starttext
\dorecu= rse{5}{\samplefile{lorem}}
%\dorecurse{1}{\samplefile{lorem}}
\stopte= xt

%%%%%%%%%%%%%%%%%%=C3=B9

Using this (almost what I'm= trying to do) without success

=
test-2.tex %%%%%%%%%%%%%
\setuppagenumbering
=C2=A0 [alternative=3Ddoublesided,location=3D= ]

\setupbackgrounds
=C2=A0 [header]
=C2=A0 [text]
=C2=A0 [f= rame=3Doff,bottomframe=3Don,
=C2=A0 =C2=A0framecolor=3Dlightgray,rulethi= ckness=3D1pt]

\startsetups[header]
=C2=A0 \doifelse{\totalnumbero= fpages}{1}
=C2=A0 =C2=A0 {\setupheadertexts[\setups{header}]}
=C2=A0 = =C2=A0 {}
\stopsetups


\starttext
\dorecurse{5}{\samplefile= {lorem}}
%\dorecurse{1}{\samplefile[lorem]r}
\stoptext
<= /span>

=
<= span class=3D"gmail-JLqJ4b gmail-ChMk0b">%%%%%%%%%%%%%%%%%%%
=
Fabrice


Le=C2=A0jeu. 26 ao=C3=BBt 2021 =C3=A0=C2=A017:56, Wolfgang = Schuster via ntg-context <ntg-cont= ext@ntg.nl> a =C3=A9crit=C2=A0:
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 remem= ber !
>> The idea is to test whether the document contains only one page or= not.
>
> Perhaps not the nicest solution, but this works:
>
> \doifvalueelse
>=C2=A0 =C2=A0 {\lastpage}
>=C2=A0 =C2=A0 {1}
>=C2=A0 =C2=A0 {\message{true}}
>=C2=A0 =C2=A0 {\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 t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/nt= g-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.net=
archive=C2=A0 : https://bitbucket.org/phg/context-m= irror/commits/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
___________________________________________________________________________= ________
--0000000000000f4f9005ca796b15-- --===============6028858545863654214== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============6028858545863654214==--