I can type
\documentclass[twocolumn]{scrartcl}
to get a document typeset in two columns. But how does this works internally? I read The TeXbook, but didn't find a single paragraph about this. (Maybe I didn't look carefully enough.)
|
I can type
to get a document typeset in two columns. But how does this works internally? I read The TeXbook, but didn't find a single paragraph about this. (Maybe I didn't look carefully enough.) |
||||
|
|
|
The routine is described by Knuth in Appendix E: Example Formats, page 417. The macros were used for two-column formatting of Appendix I, the index. The algorithm is not to difficult to follow. Everything is placed in a tall box of a width equal to the column width and then split. For a page that is full this simple algorithm works quite well. The only complication is when one needs to balance the columns in a page when there is not enough content. Here Knuth uses a loop to achieve it. The It then changes the output routine to This allows a very tall column to accumulate. When When Then Knuth writes,
Unfortunately most do and they include floating figures and tables! The LaTeX Team took extra care to provide a highly complicated two-column algorithm to cater for all these, albeit still in not such a perfect way. |
||||
|
|
|
ConTeXt supports two types of multi-column output: simple multi-columns (similar to LaTeX's twocolumn) and column-sets (much more control over spanning figures, etc.). The source code for simple multi-columns gives a lot of implementation details and history; the source code for column sets has a few comments about the implementation. |
|||
|
|