Background
Creating a custom multi-column layout having columns that differ in width.
Problem
This question's problem is mentioned but not addressed in a previous answer:
Setting
page=yes
causes an unfortunate side-effect: the book is interwoven with blank pages in between chapters. These can be eliminated using Ghostscript to post-process...
In other words, without the page=yes
option, ConTeXt is unable to format the text as desired. With the page=yes
option, ConTeXt formats as expected but exports an undesired blank page between major sections.
Code
Minimum working example that illustrates the problem:
\definepapersize[BookPaperSize][width=24in, height=12in,]
\setuppapersize[BookPaperSize]
\definelayout[BookTextLayout][
topspace=.5in,
backspace=.5in,
header=\zeropoint,
footer=\zeropoint,
grid=yes,
]
\setuplayout[BookTextLayout]
\definecolumnset[BookColumns][n=4,distance=.25in]
\setupcolumnset[BookColumns:1][width=11.75in]
\setupcolumnset[BookColumns:2][width=3.46in]
\setupcolumnset[BookColumns:3][width=3.46in]
\setupcolumnset[BookColumns:4][width=3.46in]
\setuphead[section][
page=yes,
beforesection={\startcolumnset[BookColumns]},
aftersection={\stopcolumnset},
]
\setuphead[subsection][
after={\column},
]
\setuphead[subsubsection][
after={\blank[small]},
]
\starttext
\startsection[title={Section Title}]
\startsubsection[title={Subtitle}]
\dorecurse{2}{\input knuth}
\dorecurse{2}{%
\startsubsubsection[title={Subsubtitle}]
\dorecurse{1}{\input ward}
\dorecurse{2}{\input lorem}
\dorecurse{1}{\input bryson}
\stopsubsubsection
}
\stopsubsection
\stopsection
\stoptext
Actual Output
The page before each section is blank:
Output Without Page
When the page=yes
option is removed, the output has issues:
The \column
command no longer appears to respect the column widths and the text bunches up at the bottom of the first column.
Expected Output
The desired output would not have a blank page between major sections:
Work Around
The resulting PDF contains multiple pages. Using Ghostscript works to delete every other page (e.g., using gs -sPageList=even
), which produces the desired result:
- Theory of Inflation by Roen Kelly
- Stars by James Josephides
However, the extra blank page causes knock-on problems: extra image processing steps, PDF pages need reordering, and increased compile time due to needing two passes.
Question
What needs to change so that the blank pages are eradicated from the document?
Ideas
Adding page=yes
to the \definecolumnset
and removing page=yes
from the setuphead
resolves the issue of blank pages; however, the first page columnset is scrunched to the left. I've attempted to address the issue using:
\definecounter[BookPageNumber][
way=bychapter,
prefix=no,
]
\definecolumnset[BookColumns][n=4,distance=.25in,page={\doifelse{\rawcountervalue[BookPageNumber]}{1}{}{yes}}]
\setupcolumnset[BookColumns:1][width=11.75in]
\setupcolumnset[BookColumns:2][width=3.46in]
\setupcolumnset[BookColumns:3][width=3.46in]
\setupcolumnset[BookColumns:4][width=3.46in]
\setuphead[section][
before={%
\doif{\rawcountervalue[BookPageNumber]}{1}{\page}
\incrementcounter[BookPageNumber]
},
beforesection={\startcolumnset[BookColumns]},
aftersection={\stopcolumnset},
]
However, this does not produce the desired output.