[NTG-context] pagecolumns: get the current column
mf
massifr at fastwebnet.it
Fri Jun 26 17:39:26 CEST 2020
Hello list,
I'm using a 2-columns layout and I'd like to put some information in the
margin.
I should put that information in the left margin when I'm in the left
column, and in the right margin when I'm in the right column, to prevent
the extra information overlapping the main text in the other column.
I found a useful counter in page-pcl.mkiv: \c_page_col_current.
Here's a MWE:
\unprotect
\def\curCol{\c_page_col_current}
\protect
\def\InfoInMargin#1{\doifelse{\the\curCol}{1}{\inmargin{#1}}{\inothermargin{#1}}}
\def\TestText{\InfoInMargin{\bf \the\curCol}\input ward
\InfoInMargin{\bf \the\curCol} \input ward}
\starttext
\startpagecolumns[n=2,distance=25mm]
\dorecurse{5}{\TestText\par}
\stoppagecolumns
\stoptext
\c_page_col_current works most of the time, but unfortunately it tells
you the current column before the lines of a paragraph get distributed
over columns.
So sometimes it fails. You can see that in the MWE: the bold "1" between
columns in the upper part of the page. It should be a bold "2" in the
right margin.
Is there a better way to read the current column?
Thanks,
Massi
More information about the ntg-context
mailing list