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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to