0

I'm typesetting (non-synchronized) parallel columns with paracol.sty – a translation actually, one language in the left, the other in the right column. The document contains a lot of "column-wise" floats (that is, floats typeset within a column). As paracol reads and processes the whole left column (stretching over various pages) before the right column, all the floats in the left column are numbered before the floats in the right column, even when they appear on a later page. This leads to the floats appearing in an unordered way given the linear appearance in the flow of the pages.

Is there a way to work around this? I need to keep the floats as column-wise floats (so they may not break the two-column layout).

Is there a way to modify the counter mechanism to have the numbers follow the order of appearance? Or at least in order of pages? (that is, within a page I don't mind if all left column floats are numbered before the right column floats, but this should not stretch across pages)

Or do I have to implement a "manual" numbering using \setcounter{figure}{0} etc?

Thanks a lot!

PS: I know that the paracol manual says that this "problem" occurs. But maybe someone has an idea how to resolve it.

MWE:

\documentclass{article}
\usepackage{paracol}
\usepackage{lipsum}

\globalcounter{figure}

\begin{document}

\begin{paracol}{2}
    \lipsum[1-3]
    \begin{figure}[t] 
        \caption{The caption}
        \label{Label1}
    \end{figure}
    \lipsum[2]

    \switchcolumn

    \begin{figure}[t]
        \caption{The caption}
        \label{Label2}
    \end{figure}
    \lipsum[1-3]

\end{paracol}

\end{document}

The following example shows figure 2 appearing before figure 1 if following the order of the pages.

enter image description here

  • The paracol manual explicitly states that t - float environments are problematic in synchronizing columns. You have t - float environments ;-) (requires caption package) – user31729 Mar 14 '17 at 18:19
  • Yes I know, the manual mentions this. So it's not a bug report, but maybe someone has a solution! BTW, the problem doesn't depend on the 't' positioning, it also occurs with 'h'. The problem is that numbers are given in order of source code and the whole left column is processed and broken across pages before the right column is processed. – LaTechneuse Mar 14 '17 at 18:25
  • Do you use hyperref and links? If not, there might be a easy solution. – user31729 Mar 14 '17 at 18:31
  • 1
    Have you tried to remove the \globalcounter{figure} statement? – user31729 Mar 14 '17 at 18:35
  • Removing the statement would produce separate numbering of the floats in each column, which is not what I'm looking for. And yes, alas, I'm using hyperref. – LaTechneuse Mar 14 '17 at 18:51
1

This will fix \caption, \label and \listoffigures. Note that it takes (at least) two runs.

One must add \useparafig before \caption. It redefines \thefigure for the rest of the figure environment (or current group).

It works by creating a translation table between \thefigure and the order in which the figures actually appear (\theparafig).

\documentclass{article}
\usepackage{paracol}
\usepackage{lipsum}

\globalcounter{figure}

\newcounter{parafig}

\newcommand{\newparafig}[1]{\stepcounter{parafig}%
  \expandafter\xdef\csname parafig#1\endcsname{\theparafig}}

\makeatletter
\newcommand{\useparafig}{\protected@write\@auxout{}{\string\newparafig{\thefigure}}%
  \@ifundefined{parafig\thefigure}{}%
  {\edef\parafig{\csname parafig\thefigure\endcsname}%
   \let\thefigure=\parafig}}
\makeatother

\begin{document}
\listoffigures\newpage
\sloppy
\begin{paracol}{2}
    \lipsum[1-3]
    \begin{figure}[t]
        \useparafig
        \caption{The caption}
        \label{Label1}
    \end{figure}
    \lipsum[2]

    \switchcolumn

    \begin{figure}[t]
        \useparafig
        \caption{The caption}
        \label{Label2}
    \end{figure}
    \lipsum[1-3]

\end{paracol}

\end{document}
  • Thanks, that's an amazing solution! That makes paracol a very powerful solution for publishing two-column translations. – LaTechneuse Mar 15 '17 at 14:24

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.