Changes

Jump to navigation Jump to search
3,585 bytes added ,  20:01, 24 September 2019
some hints about current column modes
< [[Visuals]] | [[Layout]] >
 
(This page is a mess. The variety of column modes is just confusing. Have a look at the [[manual:columns.pdf|Columns manual]] and the [[manual:pagecolumns.pdf|Page Columns manual]].)
= Overview =
* paragraphs : if you need a table-like structure (translations, questionaires etc.)
* column sets : the flexible way for varying columns or other complex tasks
* page columns : new column sets implementation
* streams : set different text synchronized side-by-side (e.g. bilingual editions)
Columns and columnset columnsets are two different mechanism mechanisms to produce a documentwith text and two or more columnsof text.
* The <code>columns</code> mechanism is the older one with limited control about the placement of figures but allows you to mix one column and multicolumns text on a page.
* <code>columnsets</code> is a new version of the column mechanism are meant for magazine-like layouts with more control about the placement of figures and other features like spanned columns etc. (look at the [[Columns#Column_Sets|manual]] for more); it is better than <code>. Additionally, there’s still the old columns</and columnsets code> for magazine-like layoutsavailable as a module.
=Columns=
</context>
Normally, columns are automatically balanced with the text distributed over the number or of requested columns. You can provoke a column switch using {{cmd|column}}.
<context source=yes>
Column balancing fails in "lines" mode (e.g. for poetry).
 
 
Influencing the color of the separator rule is somewhat tricky:
 
<context source=yes>
\setuppapersize[A5]
\setupcolors[textcolor=blue]
 
\color[red] % rule color, but might influence also the color of other elements
\startcolumns[n=3,rule=on]
\input knuth
\stopcolumns
</context>
=Paragraphs=
<context source="yes">
\setuppapersize[A5]
\enableregime[utf]
\defineparagraphs[TwoThird][n=2]
</context>
Another possibility is to use [[TextBackground|textbackground]] around the text. (The examples don't work in this wiki because, for security reasons, it has [[write18]] disabled. They should work for you, though, provided that [[write18]] is enabled on your local installation.)
<context source="yes">
This method offers more possibilities than simple columns,
in particular in placing floats such as figures and in creating columnspans.
See [[manual:columns.pdf|Columns manual]] or [[source:page-set.texmkiv|column sets source]] for many examples.
If you don't need much more than the "normal" columns, but e.g. "lines" mode, try this:
\stoptext
</context>
 
=Page Columns=
 
Page columns are a new implementation of columnsets, intended to replace the old mechanism.
[[manual:pagecolumns.pdf|Page Columns manual]]
 
From the [[source:page-cst.mkiv|source]]:
 
Columnsets are kind of special. They are mostly meant for special products with
magazine like properties. They are normally not mixed with single column layouts
and not all features of ConTeXt might cooperate well with a mechanism like
this. We use the name page grid because (as with other reimplementations of
MkII features in MkIV, we need another namespace in order to migrate stepwise.
This implementation is not neccessarily better than the previous one but it might
be easier to extend it. It should be a bit more efficient.
=Streams=
This is useful for, e.g., typesetting bilingual books: have the original on the even pages, the translation on the odd pages, and synchronize at certain points.
Hans later re-implemented that mechanism in the core. For details see [[source:mpage-streamsstr.texmkiv|streams module the source]].
The module provides a rather low-lever interface. Hans suggested some handy shortcuts:
Beware, streams don't work in columns and not very good in columnsets.
 
==Examples of MkIV streams==
 
(copied from the source)
 
<texcode>
\enabletrackers[streams.flushing]
 
\setuplayout[grid=yes] \showgrid
 
\starttext
 
\input tufte
 
\startoutputstream[nl]
 
Wat doen we hier?
 
\enableoutputstream[en]
 
Are you sleeping, brother John?\footnote{xxx}
 
\dorecurse{4}{x \footnote{note \recurselevel}\input tufte \par \pushoutputstream}
 
\enableoutputstream[de]
 
Bruder Jakob, schläfst du noch?\footnote{yyy}
 
\dorecurse{4}{x \footnote{note \recurselevel}\input ward \par \pushoutputstream}
 
\disableoutputstream
 
\stopoutputstream
 
Vader Jacob, slaap je nog?\footnote{zzz}
 
\input tufte
 
\synchronizestreams[en,de,nl]
 
\page \flushoutputstream[en] \input knuth
\page \flushoutputstream[de] \input knuth
\page \flushoutputstream[nl] \input knuth
 
\stoptext
</texcode>
 
Posting by Wolfgang to the mailing list (2016-11-27):
 
<texcode>
\starttext
 
\startoutputstream[one]
\setupalign[flushleft]
\dorecurse{3}{Line \recurselevel\par}\pushoutputstream
\blank
\dorecurse{6}{Line \recurselevel\par}\pushoutputstream
\blank
\dorecurse{4}{Line \recurselevel\par}\pushoutputstream
\stopoutputstream
 
\startoutputstream[two]
\setupalign[flushright]
\dorecurse{5}{Line \recurselevel\par}\pushoutputstream
\blank
\dorecurse{2}{Line \recurselevel\par}\pushoutputstream
\blank
\dorecurse{7}{Line \recurselevel\par}\pushoutputstream
\stopoutputstream
 
\synchronizestreams[one,two]
 
\startoverlay
{\outputstreambox[one]}
{\raise2\strutdp\outputstreambox[two]}
\stopoverlay
 
\stoptext
</texcode>
 
(Wolfgang continued:)
 
The mechanism to create pages/columns for the stream content is
missing.
You can save text and flush it afterwards but there is no command which
places the content side by side (or in columns). Below is a simple example
but I had to write the splitter myself.
 
<texcode>
\starttext
 
\startoutputstream[one]
\startcolor[red]
\dorecurse{10}{\input knuth\par}
\stopcolor
\stopoutputstream
 
\startoutputstream[two]
\startcolor[green]
\dorecurse{10}{\input zapf\par}
\stopcolor
\stopoutputstream
 
\synchronizestreams[one,two]
 
\setbox\scratchboxone\outputstreambox[one]
\setbox\scratchboxtwo\outputstreambox[two]
 
\doloop
{\ifvoid\scratchboxone
\exitloop
\else
\setbox\scratchboxfour\vsplit\scratchboxone to \textheight
\vbox to \vsize{\box\scratchboxfour\vss}%
\setbox\scratchboxfive\vsplit\scratchboxtwo to \textheight
\vbox to \vsize{\box\scratchboxfive\vss}%
\fi}
 
\stoptext
</texcode>
{{todo|We need documentation and samples for Paragraphs, Streams and Column Sets}}

Navigation menu