2

How could a one-column document in plain TeX be converted into a two columns document? Could somebody provide me with a sample text? I've read through "A Gentile introduction to TeX". The information that I've found in the TeXbook is above my beginner level.

4
  • 1
    Welcome tex.sx. This is not exactly what you're asking for, but the TeX Users Group journal TUGboat is produced in two columns, available for both plain TeX and LaTeX. The plain package can be found on CTAN, at ctan.org/pkg/tugboat-plain May 5, 2022 at 23:36
  • 1
    Basically you put the text into a narrow \vbox then use \vsplit to pull off one column/page at a time. May 6, 2022 at 3:16
  • @barbarabeeton Thank you Barbara. I've commented out most of the header text "TUGboat, Volume 0 (2001), No. 0 preliminary draft ..." but I have problem getting rid of the first (or is it the second) comma after "TUGBoat" The pagenumber is preset to 901 so I added \pageno = \count0 w no success May 6, 2022 at 16:09
  • 1
    In tugboat.sty, the \pageno=901 is setting an actual value (it's how we quickly distinguish a draft from the final version of an item). Reset it to \pageno=1, not to a counter. Regarding the comma after "TUGboat", that's found in the definition of \rtitlex, after \TUB,. I know this style file is overmuch for someone just setting out, but it's worked successfully in production for over three decades, through many changes of technology, and hasn't been "cleaned" much with such changes. May 6, 2022 at 16:47

1 Answer 1

3

The macros \begmulti...\endmulti from OpTeX or OPmac does multicolumn typsetting in single case: it sets the material between \begmulti...\endmulti into a \vbox with \hsize=column_width and then it measures the free space on the page using \pagegoal and \pagetotal. If there is sufficient space then \balancecolumns is run. This macro is based on \vsplit primitive. If there is no space on the page, the \vsplit is done to the height of the rest of the page, something like \line{col1\hfil\col2} is created and this is put to the page. The process is repeated on the next page until the \vbox with accumulated material is empty. We need not to change the output routine when this macro is used, but the macro cannot work with inserts (i.e. footnotes).

If you want to use footnotes inside the columns material then you have to create a new output routine. The the principle follows:

When two columns start then you must put a message to the output routine using (for example) \penalty-10013 and the routine only saves the previous material into box but does not create a page. The \vsize is re-calulated and \hsize is set to the column width. The columns state is set. When the column material reaches the new \vsize then the output routine is called again as usual and it knows that now there is column state. So the \box255 is \vsplit to two parts, the \line{col1\hfil\col2} is constructed and the page is created from saved box followed by this \line followed by box from insert for footnotes. If the two column mode ends, you must to put a special message to the output routine (say \penalty-10014) and the output routine runs \balancecolumns of \box255, creates \line{col1\hfil\col2} and all material returns to the current page. The column state is switched off.

0

You must log in to answer this question.

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