# How to fix figure numbering with paracol and memoir

tl;dr at the end in bold font.

So, I am writing a labbook with the memoir class and am using paracol to put pictures of some lab utensils in the right column so they don't clutter up the main body text. So far, so good. Now, I have a few pictures I would like to be displayed bigger and the figure environment to occupy the whole linewidth, so I take them out of the paracol environment and set them in a regular one-column figure environment, interrupting the paracol environment

I would like those images to be numbered continuously and have looked at a diverse set of possible part-solutions as to how to do so. Furthermore, I managed to get the numbering out of the chapters and sections, as this is irrelevant to my document. Speaking of irrelevance, let's not turn around the hot pot any longer and look at some code for you to try at home:

\documentclass[a4paper,oneside,openany,12pt]{memoir}

\usepackage{duckuments}
\usepackage{graphicx} % for the duckument images

% functionality from chngcntr included in memoir class
\counterwithout{figure}{chapter}
\counterwithout{section}{chapter}

\usepackage{paracol}
\setcolumnwidth{0.58\textwidth}

\begin{document}
\listoffigures

\section{First Duck}
\blindduck
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{First Duck}
\end{figure}

\newpage

\section{Second Duck}
\begin{paracol}{2}
\blindduck
\switchcolumn
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Second duck}
\end{figure}
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Third duck}
\end{figure}
\switchcolumn
\blindduck
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Force duck}
\end{figure}
\end{paracol}

\newpage

\section{Fifth Duck}
\blindduck
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Fifth Duck}
\end{figure}
\blindduck
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Inter-Duck}
\end{figure}

\newpage

\section{The Sith duck}
\begin{paracol}{2}
\blindduck
\switchcolumn
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Sith duck}
\end{figure}
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Seventh duck}
\end{figure}
\switchcolumn
\blindduck
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Eighth duck}
\end{figure}
\end{paracol}

\end{document}

As you will notice when compiling this (provided you have installed duckuments and followed the steps to set it up correctly), you will notice odd numbering of the figures. You can try different set ups as to when to call paracol and put images in different places. For the kinky out there, I would like to recommend following a paracol environment by a second paracol environment. Amusing results!

I would like to have a body of text with occational images in regular fashion, as well as images in a right (or left, for what it's worth) column. All the images should be numbered continuously. It doesn't need to be in memoir class and with paracol environment, but this is the best I could come up with so far.

• Paracol can use separate or common counters. Use \globalcounter{figure} and \globalcounter{table} (page 6 of manual). – John Kormylo Sep 15 '18 at 14:08
• OTOH, there isn't an easy fix for the list of figures. These are listed in the order in which they appear in the aux file, which is the order in which they are expanded (left column first), not created. – John Kormylo Sep 15 '18 at 14:24
• @JohnKormylo yes, I managed to find the user manual entry about \globalcounter this morning and intended to write about it. I did some more experimenting and will post my findings later, if you don't do it before I do. Thanks for the hint, though ;) – thymaro Sep 15 '18 at 15:17

Firstly, we need to tell memoir to use a \globalcounter{figures} in the preamble. This will fix the numbers in that the same number won't appear repeatedly. Now they aren't in order, though.

As John Kormylo notes in a comment to the question:

[The figures] are listed in the order in which they appear in the aux file, which is the order in which they are expanded (left column first), not created.

Because of this, the order of figures has to be managed a bit more manually than what one would be used to in LaTeX.

At this point, you might have noticed that figure 4 is listed in the LOF right after figure 1 (see quote above for reasons). To change that, you could end the paracol environment after figure 3 and begin another paracol environment right away, then use variant 1. Alternatively, you could rearrange your sourcecode, then use variant 2. Note, however, that variant 2 will alter the numbering order of your figures. In the example, the "Force Duck" becomes figure 2.

Lastly, you could choose to have all the small images in the one column and only text will be in the other column. In this case, \switchcolumn between text and images. With \globalcounter{figures} active, your figures should then be numbered correctly (untested).

### Variant 1

\documentclass[a4paper,oneside,openany,12pt]{memoir}

\usepackage{duckuments}
\usepackage{graphicx} % for the duckument images

% functionality from chngcntr included in memoir class
\counterwithout{figure}{chapter}
\counterwithout{section}{chapter}

\usepackage{paracol}
\setcolumnwidth{0.6\textwidth}

\globalcounter{figure}

\begin{document}
\listoffigures

\section{First Duck}

\blindduck

\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{First Duck}
\end{figure}

\clearpage

\section{Second Duck}
\begin{paracol}{2}

\blindduck

\switchcolumn

\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Second Duck}
\end{figure}
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Thursduck}
\end{figure}

\switchcolumn[0]

\blindduck

\end{paracol}                                 % NEW
% NEW
\begin{paracol}{2}                            % NEW

\switchcolumn[0]*

\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Force Duck}
\end{figure}

\end{paracol}

\clearpage

\section{Fifth Duck}
\blindduck
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Fifth Duck}
\end{figure}
\blindduck
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Sith Duck}
\end{figure}

\clearpage

\section{Seven Ducks}
\begin{paracol}{2}
\blindduck
\switchcolumn
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Seven Ducks}
\end{figure}
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Eighduck}
\end{figure}
\switchcolumn
\blindduck
\end{paracol}

\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Ninth Duck}
\end{figure}

\end{document}

### Variant 2

\documentclass[a4paper,oneside,openany,12pt]{memoir}

\usepackage{duckuments}
\usepackage{graphicx} % for the duckument images

% functionality from chngcntr included in memoir class
\counterwithout{figure}{chapter}
\counterwithout{section}{chapter}

\usepackage{paracol}
\setcolumnwidth{0.6\textwidth}

\globalcounter{figure}

\begin{document}
\listoffigures

\section{First Duck}

\blindduck

\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{First Duck}
\end{figure}

\clearpage

\section{Second Duck}
\begin{paracol}{2}

\blindduck

\blindduck                                  % MOVED

\begin{figure}[htbp]                        % MOVED
\centering                              % MOVED
\includegraphics{example-image-duck}    % MOVED
\caption{Force Duck}                    % MOVED
\end{figure}                                % MOVED

\switchcolumn

\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Second Duck}
\end{figure}
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Thursduck}
\end{figure}

\end{paracol}

\clearpage

\section{Fifth Duck}
\blindduck
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Fifth Duck}
\end{figure}
\blindduck
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Sith Duck}
\end{figure}

\clearpage

\section{Seven Ducks}
\begin{paracol}{2}
\blindduck
\switchcolumn
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Seven Ducks}
\end{figure}
\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Eighduck}
\end{figure}
\switchcolumn
\blindduck
\end{paracol}

\begin{figure}[htbp]
\centering
\includegraphics{example-image-duck}
\caption{Ninth Duck}
\end{figure}

\end{document}