ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Joey McCollum <jmccollum20140511@gmail.com>
Subject: Re: Blank page added after pagecolumns
Date: Sat, 16 May 2020 10:12:49 +0200	[thread overview]
Message-ID: <e01f3dcc-5586-8501-d7ce-73efe371c0a2@gmail.com> (raw)
In-Reply-To: <CAGxRUG_ythQNWGZ1d3QLNH0MEdXFztFxh0Cfc6o-qy385bWfPw@mail.gmail.com>

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
___________________________________________________________________________________
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:[~2020-05-16  8:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 17:40 Joey McCollum
2020-05-02 15:46 ` Joey McCollum
2020-05-04 18:45   ` Joey McCollum
2020-05-11  0:34     ` Thangalin
2020-05-14 21:03       ` Joey McCollum
2020-05-16  3:45         ` Joey McCollum
2020-05-16  8:12           ` Wolfgang Schuster [this message]
2020-05-16 13:31             ` Joey McCollum

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=e01f3dcc-5586-8501-d7ce-73efe371c0a2@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=jmccollum20140511@gmail.com \
    --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).