4

In a two-column layout, I need to create references returning the line and column numbers of the target referred to.

As there does not seem to exist a column counter, the column numbers displayed in the header are calculated from the page number.

I can refer to line numbers by the commands \someline (for the target) and \inlinerange (for the reference), and I can refer to page numbers by \pagereference (for the target) and \at (for the reference). But how can I refer to the column?

To calculate the column number of the target referred to (according to what I did in the header), I would need (besides the page number) the information whether the target is in the left or in the right column. How can I get this information?

(In the ConTeXt-reference on page 79, there is an example using a command \currentcolumn, which for me, however, always returns 1; and the example does not work for me anyway.)

Below, I give an example of my two column setup with references to lines and pages, where I would need the column numbers instead:

\setuppapersize[A4][A4]
\setupbodyfont[9pt]

\setupcolumns[
    n=2,
    distance=1cm,
]

\setuplinenumbering[
    step=5,
    method=page,
    location=right,
    align=flushright,
    width=.25cm
]

\setupheadertexts[]
\setupheadertexts
[\ctxlua{context(2 * tex.count.pageno - 1)}]
[\ctxlua{context(2 * tex.count.pageno)}]
[\ctxlua{context(2 * tex.count.pageno - 1)}]
[\ctxlua{context(2 * tex.count.pageno)}]

\starttext

\startcolumns
\startlinenumbering
\dorecurse{2}{\input lorem}\par
REFERENCE 1: Target 1 is in line \inlinerange[TestI], column ? (how to get this?) on page \at[TestI].\par
\dorecurse{2}{\input lorem}\par
\someline[TestI]\pagereference[TestI]TARGET 1.\par
\dorecurse{2}{\input lorem}\par
\stoplinenumbering
\stopcolumns

\stoptext

The result of which is:

PDF with references to lines and pages

  • Cross references are stored in the tuc file. Searching for TestI it seems as if column information is not stored as part of the references. If you want to have this feature, you should ask on the mailing list. – Henri Menke Sep 7 '19 at 7:11
  • Thanks. I already asked twice on the mailing list, but got no response. So I'm afraid it is just not possible to do this with ConTeXt. – OvC Sep 9 '19 at 12:04
  • Sometimes you have to bump the thread. When I don't get an answer on the list but I really need one, I usually bump the thread every two to four weeks. At some point somebody will answer. As you see, after I bumped the thread Hans implemented the feature for you. – Henri Menke Sep 10 '19 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.