4

This question arose in the comments in Ragged-bottom footnotes in ConTeXt; I have since reported the issue to the ConTeXt mailing list, but I have not heard anything back so far, so I decided I should ask about it here as well. If I get an answer either here or on the mailing list, I will share the answer in the other place, to make it more likely that anyone else running into this issue will find a solution.

I am typesetting a document using pagecolumns to ensure that my footnotes are set ragged-bottom in columns. I have observed some unexpected behavior whenever the last column on a page is left incomplete: a blank page is added at the end of the document. A minimal working example follows:

\starttext

\startpagecolumns[n=2]

\dorecurse{3}{\par\input zapf}

\stoppagecolumns

\stoptext

I typeset this using ConTeXt version 2020.03.10, as released with TeXLive 2020. Notably, if \dorecurse{3} is changed to \dorecurse{2} or \dorecurse{6} (so that the text ends in the first column of a page), then there is no problem. The issue is also not limited to one-page documents; if \dorecurse{3} is changed to \dorecurse{8}, then what would normally be a two-page document is extended to a three-page document. I have tried to fix this by specifying page=no in the \startpagecolumns arguments (similar to the fix for section blocks in https://www.contextgarden.net/Empty_page_at_the_end), but it did not change anything.

In several of the examples (including those for side floats and footnotes) found in the pagecolumns manual ( http://www.pragma-ade.com/general/manuals/pagecolumns.pdf), the addition of a blank page after the end of the environment also seems to occur. So when the manual says, "We always start at a new page and end on a new one," does it mean that the blank page is an intended feature of pagecolumns? And if so, is there any way to disable it? Adding a page break after the end of the pagecolumns environment makes perfect sense, but an additional empty page is unnecessary. I checked the ConTeXT Garden Wiki for a page on the \definepagecolumns command to get more information on its accepted inputs, but there doesn't appear to be a page for this command.

This issue is very similar to the one addressed in ConTeXt: Suppress blank page when text reaches column's end, where a blank page is added after columnset environments. In that question, the proposed solution is to redefine the \page_grd_stop macro found in page-cst.mkiv. Unfortunately, this does not fix the problem with pagecolumns in my MWE. Are pagecolumns commands aliased to pagegrid commands like columnset commands are, or are they defined somewhere else? I checked page-col.mkiv, but it seems to be too short to be the file that defines pagecolumns behavior.

Is there a fix for this that I'm missing?

1
  • It looks like the place to look for the pagecolumns source code is page-pcl.mkiv (source.contextgarden.net/tex/context/base/mkiv/page-pcl.mkiv). The definition of \page_col_stop_yes seems to have something to do with the issue. If I redefine it in my MWE and comment out the two \page calls, then no extra page is added when the text ends in the last column; however, this results in the last page not getting typeset if its text ends in a column before the last one. I think I'm close, but I need to do a bit more experimentation (or get a bit more help) before I have a real answer. Commented May 14, 2020 at 20:55

1 Answer 1

1

I was able to figure out an answer thanks to Wolfgang Schuster. As I mentioned in a comment on the question, the pagecolumns source code is located in page-pcl.mkiv. In that code, 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. The choice depends on the number of columns (i.e., the n option for the pagecolumns environment) is more than one, then the "yes" implementation of the start and stop commands is used; otherwise, the "no" implementation is used.

The fix that Wolfgang Schuster proposed was to patch the \page_col_stop_yes macro to add a column only if the environment does not end on the last column of the page:

\unprotect
\def\page_col_stop_yes
  {%Add a column only if this is not the last column on the 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}
\protect

That said, the addition of a blank page appears to be an issue in the code that needs to be fixed, but in the meantime, this patch should work.

1
  • One further note: when I use a two-sided page layout, I've found that it is still necessary in practice to add \page[no] at the end of the pagecolumns environment to prevent ConTeXt from adding a formatted final page to get an even page count. With \page[no], it will still need to add a page to get an even page count, but the page will correctly have empty formatting (i.e., no headers, page numbers, etc.). Commented Jun 13, 2020 at 13:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .