How can I test whether I'm on the left or right column of multicol?

I am trying to build a two-column table of contents, where formatting depends on wether the entry is on the left or right column

Here's a mockup (code below).

enter image description here

% mock TOC commands ===================================

  \hfill\myStrut\textbf{\large #2} \ #1\par}

  #1 \ \myStrut\textbf{\large #2}\hfill\par}


\begin{document} % ====================================


\myTocEntry{Exciting discovery}{5}
\myTocEntry{Visiting Delphi}{10}

\columnbreak % new column =============================

\myTocEntry{First-order problems}{20}
\myTocEntry{The pit}{30}
\myTocEntry{Not all is lost}{35}


\end{document} % ======================================
  • 1
    Possible duplicate: Detecting current column in multicol
    – Werner
    Mar 8 '18 at 16:25
  • Will you always create the ToC manually?
    – Werner
    Mar 8 '18 at 16:28
  • @Werner no, I would like it done automatically. Your link looks perfect. Reading it now.
    – Tássio
    Mar 8 '18 at 16:38

It is really part of multicol packages for quite some time: option colactionand comand \docolaction.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.