From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/112621 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Wolfgang Schuster via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Test for displaying a header Date: Fri, 27 Aug 2021 18:05:25 +0200 Message-ID: <7b58ae30-92f7-4f3b-366d-84f8c32ca102@gmail.com> References: <40A5A4E3-D83B-49CC-86C0-E402899F7B47@bittext.nl> <5a9e0c8c-1b30-41cf-0429-ff854a7b7fd5@gmail.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1239099201700009952==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25733"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.48 Cc: Wolfgang Schuster , mailing list for ConTeXt users To: Fabrice Couvreur Original-X-From: ntg-context-bounces@ntg.nl Fri Aug 27 18:06:06 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 1mJeMn-0006S2-VC for gctc-ntg-context-518@m.gmane-mx.org; Fri, 27 Aug 2021 18:06:05 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 0F652286D6A; Fri, 27 Aug 2021 18:05:34 +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 G1H3sAHBs0xE; Fri, 27 Aug 2021 18:05:32 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 896FE286DA3; Fri, 27 Aug 2021 18:05:32 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id B8D96286D7D for ; Fri, 27 Aug 2021 18:05:30 +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 SKEadjTC1k5g for ; Fri, 27 Aug 2021 18:05:29 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.128.49; helo=mail-wm1-f49.google.com; envelope-from=wolfgang.schuster.lists@gmail.com; receiver= Original-Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 E6F3A286D6A for ; Fri, 27 Aug 2021 18:05:28 +0200 (CEST) Original-Received: by mail-wm1-f49.google.com with SMTP id z9-20020a7bc149000000b002e8861aff59so5439390wmi.0 for ; Fri, 27 Aug 2021 09:05:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=fwqmSp39tBUBsPWe7MO6CAU5Y2+F1qrUzQ0srVgCT98=; b=BG4xsjLmvJNJHMtlPmN+glvk9bA6Qe+aru7A8xSAUnNihS5UhNJYsGxodfCcUuKDL7 9FYa/nypjWxnyoBUYzLJau4eSWtpmWq5hIw0Gbso2RhnSabl9pkAZabJ6JvjJ7uDgo2S A0ttYiN7Jjt4JEfKcNonBc+xqDYh8yOXFzKpnGDNHkoMo2eGqOZDpdOXhFy0/OnW86LC Z8CKuMmwoKVFCdSplRDmwv/JOd1Ot9hi5IwPTOJC7qmQWF5k35Sw2zblmltEcm2tLzE+ tCRUC85NZ2VqzDF2Jb2wzkOC1D9KTAh+n42uRug5JaiH4YJvchCYg/ABYOcDaOIrlFkL NJBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=fwqmSp39tBUBsPWe7MO6CAU5Y2+F1qrUzQ0srVgCT98=; b=nOl2rAH7WLU8OsAIvoVxWziXrDY1aDC2QNUEMbh36I7zWILORKPbpPmqaAiBTTSsVI hmx3og2L5QeJYj+qowKoQUtkh/fSd/iijHaalhjTJL5wPwSf1PH5b4YHUa2sn6X0J1t/ 4KZKHQMN31nhUSTuq14rgfH+mYFFjmSGGVL5k/GqlQWoxMiKSyEvrvP34CuFfA0mai0n Ix63J4wL3FweDup0n9jnPCghkfFkuOGi0tdES3+SjVQGMe/XT0y7U5D/jFT0jxtuLX/i 4B4/YMSDFELV2NZj5acabLYpLJRo/4AfyYM8xm70HyxJBvPVPkYMDfRXlh0vud0kEkA6 0dWA== X-Gm-Message-State: AOAM5300mlGQIlTkjpvENyVziCB2uW1EGveB1GcFBp+fpfVPIpROTZMG pPUBf++mmwV63y5AbSBdsev0FvFTGb0= X-Google-Smtp-Source: ABdhPJzuFuqmcxmS8R5Cz8drooZUCLNOe0N7cNVH9g33BcRY2GBpRKvw2mW+wjXeQMYvlWXVbwGUUA== X-Received: by 2002:a05:600c:4ba3:: with SMTP id e35mr9675096wmp.130.1630080327283; Fri, 27 Aug 2021 09:05:27 -0700 (PDT) Original-Received: from ?IPv6:2a02:810d:a8bf:d45c:39b9:d42b:fd11:b284? ([2a02:810d:a8bf:d45c:39b9:d42b:fd11:b284]) by smtp.gmail.com with ESMTPSA id b62sm1219950wmb.17.2021.08.27.09.05.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Aug 2021 09:05:26 -0700 (PDT) In-Reply-To: Content-Language: en-US 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:112621 Archived-At: This is a multi-part message in MIME format. --===============1239099201700009952== Content-Type: multipart/alternative; boundary="------------99606D6E147E95F81B8E36A6" Content-Language: en-US This is a multi-part message in MIME format. --------------99606D6E147E95F81B8E36A6 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Fabrice Couvreur schrieb am 27.08.2021 um 10:04: > Hi Wolfgang, > This may not be nicest but seems to work > Fabrice > > %%%%%%%%%%%%%%%%%%%%%% > > \definelayout > [1] >   [header=10mm] > > \setuplayout >   [header=0pt, >  height=middle] > > \setuppagenumbering > [alternative=doublesided,location=] > > \setupbackgrounds > [header] >   [text] >   [frame=off,bottomframe=on, >  framecolor=lightgray,rulethickness=1pt] > > \startsetups[header] > \doifelse{\totalnumberofpages}{1} >     {\setuplayout[1]} > {\setuplayout[reset]} > \stopsetups > > > \starttext > \input knuth > %\dorecurse{10}{\input knuth\par} > \stoptext I have no idea what you try to achieve but the check for the number of pages in your document is never used. The layout on the first page is different from the following pages but this is just how \definelayout work when you use a number as first argument. What you have to understand is that a setups-environment is just a macro definition where you provide the names as argument to the start command. This means     \startsetups [header]     ...     \stopsetups works the same way as     \def\internalname_header       {...} but you have to use     \setups [header] rather than     \internalname_header to get the content of the environment. Wolfgang --------------99606D6E147E95F81B8E36A6 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Fabrice Couvreur schrieb am 27.08.2021 um 10:04:
Hi Wolfgang,
This may not be nicest but seems to work
Fabrice

%%%%%%%%%%%%%%%%%%%%%%

\definelayout
  [1]
  [header=10mm]

\setuplayout
  [header=0pt,
   height=middle]

\setuppagenumbering
  [alternative=doublesided,location=]

\setupbackgrounds
  [header]
  [text]
  [frame=off,bottomframe=on,
   framecolor=lightgray,rulethickness=1pt]

\startsetups[header]
  \doifelse{\totalnumberofpages}{1}
    {\setuplayout[1]}
    {\setuplayout[reset]}
\stopsetups


\starttext
\input knuth
%\dorecurse{10}{\input knuth\par}
\stoptext

I have no idea what you try to achieve but the check for the number of pages in your document is never used. The layout on the first page is different from the following pages but this is just how \definelayout work when you use a number as first argument.


What you have to understand is that a setups-environment is just a macro definition where you provide the names as argument to the start command. This means

    \startsetups [header]
    ...
    \stopsetups

works the same way as

    \def\internalname_header
      {...}

but you have to use

    \setups [header]

rather than

    \internalname_header

to get the content of the environment.


Wolfgang

--------------99606D6E147E95F81B8E36A6-- --===============1239099201700009952== 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== --===============1239099201700009952==--