From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/107330 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Joey McCollum Newsgroups: gmane.comp.tex.context Subject: Re: Blank page added after pagecolumns Date: Sat, 16 May 2020 09:31:38 -0400 Message-ID: References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3883780601289215313==" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="90901"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mailing list for ConTeXt users To: Wolfgang Schuster Original-X-From: ntg-context-bounces@ntg.nl Sat May 16 15:32:19 2020 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 1jZwvK-000NZi-PE for gctc-ntg-context-518@m.gmane-mx.org; Sat, 16 May 2020 15:32:18 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 04ECF183AA1; Sat, 16 May 2020 15:31:54 +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 ydQhEU2Wosa6; Sat, 16 May 2020 15:31:52 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 2477D183ECE; Sat, 16 May 2020 15:31:52 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 214EF183EA0 for ; Sat, 16 May 2020 15:31:51 +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 PxOHTtbbiD-8 for ; Sat, 16 May 2020 15:31:50 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.218.44; helo=mail-ej1-f44.google.com; envelope-from=jmccollum20140511@gmail.com; receiver= Original-Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 628B6183AA1 for ; Sat, 16 May 2020 15:31:50 +0200 (CEST) Original-Received: by mail-ej1-f44.google.com with SMTP id s3so4708063eji.6 for ; Sat, 16 May 2020 06:31:50 -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 :cc; bh=p7RqIDdujT14avcwXgA8CYKVwxaHS+MOp/r402JIAfk=; b=HMc3uKVVccdrJqkWWeYPRSga3ebaqaMKy793z4snPf6yOgUtTDcvONeJVvWtO9OUDH HK1orQi3LWDswYsMgmthRZVpUT9sSScz3Pq7Mcaz0y51QqibivWHuSbJkpbhorIwP9TZ 26BJUFdWhzwBvsA4/xXAAB2zei+24j2tXBMNwSUjTU6yXacMVd/dZk6MRrOvPlpcRg6Q badxLX+gnrLBNOWE3fjMURMcsPLFeXnbyZdwJlqIoNLNRFFUgzUkLyo2nykvy2kVPSQ4 U68q631qfbhdM5eAq3k7ojRHSnbHbXhakvJJrFqSfTco1RbEvIpgxrqMdfnK78xvLede ajZA== 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:cc; bh=p7RqIDdujT14avcwXgA8CYKVwxaHS+MOp/r402JIAfk=; b=sGYxtbekPtPQpYgJD6QKJHjnk8jZHH+dZHHsoV832Ux9KgZOxPfHzQWho8SyZqd+5o 8ol11jOHoObGk70i8U0kbusuoq96ofhkegar9wqwzvorwszKm3baXfyZrfrovrFSH5Bd rnWYYiqurHfMmPhDThHzIvFt3DWO+b4NzHNItURot0K8pj3nv/WQt27kronSjldFVXb7 cfkqHe2XEXK7be9jYMFLm9TjuyBBeevLfHNzTH/LbkgpuBgR9TltGruD6lga3E2m1taR zPjNUD2qzmkebFjhQego5sUi5NR4lHLxt+qjg4SfHc3SAGSW7nK9KuUAankwSo+ATvi1 6l/g== X-Gm-Message-State: AOAM530USS0rkBcGiB5RZjI3ch02wCYQ6eZvCBXNd6SpTCL1FB5utuI2 BhnsauRBQV53dLeiVu3dxWMnWsQXnRqrga8N7qc= X-Google-Smtp-Source: ABdhPJxt0Sa/Vou8IC0kb7Vej+jdrSMUZiGMhV/KwoKeff5e6bngdy8t13NvBPjB/Js4Kn5j7Gaw3e2mCrq+rHJ48X4= X-Received: by 2002:a17:906:1502:: with SMTP id b2mr7521911ejd.359.1589635909883; Sat, 16 May 2020 06:31:49 -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:107330 Archived-At: --===============3883780601289215313== Content-Type: multipart/alternative; boundary="000000000000bb1fc505a5c3f30c" --000000000000bb1fc505a5c3f30c Content-Type: text/plain; charset="UTF-8" I thought that the "yes" and "nop" suffixes were related to "page=yes" and "page=no" for a few reasons. First, because I thought "nop" could be shorthand for "no page." More importantly, however, I thought they might be related because setting page=no in \definepagecolumns does not appear to have any effect, and patching \page_col_stop_yes to do what \page_col_stop_nop does had the desired effect. But as you have shown, doing this causes problems with the transition back to a single-column layout, so I suppose that the \page_col_stop_yes and \page_col_stop_nop macros are meant to implement behavior dependent on the number of columns. Your suggestion to add a column if the column at the end of the environment is not the last one is elegant and works on different variations of the MWE, including cases with more than two columns. Joey On Sat, May 16, 2020 at 4:12 AM Wolfgang Schuster < wolfgang.schuster.lists@gmail.com> wrote: > Joey McCollum schrieb am 16.05.2020 um 05:45: > > All right, I've found a tentative solution that appears to work in all > > cases, but I'd like to know more about why the code I'm patching was > > implemented in the first place, because I don't want to break anything > > else. According to the code in page-pcl.mkiv, the \stoppagecolumns macro > > has two implementations, \page_col_stop_yes and \page_col_stop_nop. The > > choice of which implementation is used is determined by which of two > > implementations of \startpagecolumns (\page_col_start_yes > > and \page_col_start_nop) is used. That choice, in turn, is made in > > the \page_col_start macro, in the following lines: > > > > ``` > > \c_page_col_n_of_columns\pagecolumnsparameter\c!n\relax > > \ifnum\c_page_col_n_of_columns>\plusone > > \expandafter\page_col_start_yes > > \else > > \expandafter\page_col_start_nop > > \fi > > ``` > > > > so if the number of columns (i.e., the n option for the > > pagecolumns environment) is more than one, the "yes" implementation of > > the start and stop commands is used. > > > > But this seems wrong. The naming convention for the two implementations > > ("yes" and "nop") suggests that they should be related the parameters > > "page=yes" and "page=no" (hence, no page, which is what I think "nop" > > abbreviates), but the choice of which implementation to use is > > determined not by the page parameter, but by the n parameter. Is this an > > error in the code, or am I just understanding this incorrectly? Is there > > some reason why a layout with more than one column would need special > > instructions to add a blank page after stopping the environment? > > Why do you think "yes" and "nop" are related to the page-key? > > > In any event, I was able to solve the problem by patching the > > \page_col_start_yes macro to invoke the \page_col_start_nop macro as > > follows: > > > > ``` > > > > \unprotect > > > > \def\page_col_stop_yes > > {\page_col_stop_nop} > > > > \protect > > > > ``` > > > > With this fix, the MWE I provided works regardless of which column the > > text ends in. I'm content to consider the problem solved, but I would > > certainly appreciate any feedback on my thoughts and questions about > > page-pcl.mkiv. > > You broke now now normal single columns text after the pagecolumns > environment. A better fix is to add a check for the \column command at > the end of the environment and add it only when we aren't in the last > column. > > \unexpanded\def\page_col_stop_yes > {%\column % \page_otr_eject_page > \ifnum\c_page_col_current<\c_page_col_n_of_columns > \column > \fi > \page > \endgroup > % \setupoutputroutine[\s!singlecolumn]% > \page_otr_command_set_vsize > \page_otr_command_set_hsize > \page > \endgroup} > > Wolfgang > --000000000000bb1fc505a5c3f30c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I thought that the "yes" and "nop" suf= fixes were related to "page=3Dyes" and "page=3Dno" for = a few reasons. First, because I thought "nop" could be shorthand = for "no page." More importantly, however, I thought they might be= related because setting page=3Dno in \definepagecolumns does not appear to= have any effect, and patching \page_col_stop_yes to do what \page_col_stop= _nop does had the desired effect. But as you have shown, doing this causes = problems with the transition back to a single-column layout, so I suppose t= hat the=20 \page_col_stop_yes and \page_col_stop_nop macros are meant to implement beh= avior dependent on the number of columns. Your suggestion to add a column i= f the column at the end of the environment is not the last one is elegant a= nd works on different variations of the MWE, including cases with more than= two columns.

Joey

On Sat, May 16, 2020 at 4:12 AM = Wolfgang Schuster <= wolfgang.schuster.lists@gmail.com> wrote:
Joey McCollum schrieb am 16.05.2020 um 05:= 45:
> All right, I've found a tentative solution that appears to work in= all
> cases, but I'd like to know more about why the code I'm patchi= ng was
> implemented in the first place, because I don't want to break anyt= hing
> else. According to the code in page-pcl.mkiv, the \stoppagecolumns=C2= =A0macro
> has two implementations,=C2=A0\page_col_stop_yes and=C2=A0\page_col_st= op_nop. The
> choice of which implementation is used is determined by which of two <= br> > implementations of \startpagecolumns=C2=A0(\page_col_start_yes
> and=C2=A0\page_col_start_nop) is used. That choice, in turn, is made i= n
> the=C2=A0\page_col_start macro, in the following lines:
>
> ```
> \c_page_col_n_of_columns\pagecolumnsparameter\c!n\relax
>=C2=A0 =C2=A0 =C2=A0\ifnum\c_page_col_n_of_columns>\plusone
>=C2=A0 =C2=A0 =C2=A0 =C2=A0\expandafter\page_col_start_yes
>=C2=A0 =C2=A0 =C2=A0\else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0\expandafter\page_col_start_nop
>=C2=A0 =C2=A0 =C2=A0\fi
> ```
>
> so if the number of columns (i.e., the n option for the
> pagecolumns=C2=A0environment) is more than one, the "yes" im= plementation of
> the start and stop commands is used.
>
> But this seems wrong. The naming convention for the two implementation= s
> ("yes" and "nop") suggests that they should be rel= ated the parameters
> "page=3Dyes" and "page=3Dno" (hence, no page, whic= h is what I think "nop"
> abbreviates), but the choice of which implementation to use is
> determined not by the page parameter, but by the n parameter. Is this = an
> error in the code, or am I just understanding this incorrectly? Is the= re
> some reason why a layout with more than one column would need special =
> instructions to add a blank page after stopping the environment?

Why do you think "yes" and "nop" are related to the pag= e-key?

> In any event, I was able to solve the problem by patching the
> \page_col_start_yes macro to invoke the \page_col_start_nop macro as <= br> > follows:
>
> ```
>
> \unprotect
>
> \def\page_col_stop_yes
> {\page_col_stop_nop}
>
> \protect
>
> ```
>
> With this fix, the MWE I provided works regardless of which column the=
> text ends in. I'm content to consider the problem solved, but I wo= uld
> certainly appreciate any feedback on my thoughts and questions about <= br> > page-pcl.mkiv.

You broke now now normal single columns text after the pagecolumns
environment. A better fix is to add a check for the \column command at
the end of the environment and add it only when we aren't in the last <= br> column.

\unexpanded\def\page_col_stop_yes
=C2=A0 =C2=A0{%\column % \page_otr_eject_page
=C2=A0 =C2=A0 \ifnum\c_page_col_current<\c_page_col_n_of_columns
=C2=A0 =C2=A0 =C2=A0 \column
=C2=A0 =C2=A0 \fi
=C2=A0 =C2=A0 \page
=C2=A0 =C2=A0 \endgroup
=C2=A0 % \setupoutputroutine[\s!singlecolumn]%
=C2=A0 =C2=A0 \page_otr_command_set_vsize
=C2=A0 =C2=A0 \page_otr_command_set_hsize
=C2=A0 =C2=A0 \page
=C2=A0 =C2=A0 \endgroup}

Wolfgang
--000000000000bb1fc505a5c3f30c-- --===============3883780601289215313== 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== --===============3883780601289215313==--