I use three packages (in a latex "book" document) to display source files (not only tex and sometimes loaded from external files) and their outputs (sometimes loaded from external files) side by side.
- listings for the syntax highlighting
- paracol to display side-by-side
- mdframed to customize appearance
My problem is, that this causes warnings of multiply defined labels (somewhere inside mdframed I think):
WARNING: Label 'mdf@pagelabel-1' multiply defined
WARNING: There were multiply defined labels
I hacked my way through, but I'm not satisfied with my solution... is there a better way?
Here is my minimal "working with warnings" example. My hacks are commented out (to use them toggle comment on the \switchcolumn command to).
\documentclass[]{book}
\usepackage{listings}
\usepackage{mdframed}
\usepackage{paracol}
\lstnewenvironment{insertcode}{\mdframed}{\endmdframed}
%-------------------------------------------------------
%\newcounter{mdfzrefhack}
%\setcounter{mdfzrefhack}{1}
%\newcommand{\swcsafe}{
%\switchcolumn
%\setcounter{mdf@zref@counter}{\value{mdfzrefhack}}
%\addtocounter{mdfzrefhack}{1}
%}
%=======================================================
%-------------------------------------------------------
\begin{document}
\begin{paracol}{2}
\begin{insertcode}
x
\end{insertcode}
%-------------------------------------------------------
%\swcsafe
%=======================================================
\switchcolumn
%-------------------------------------------------------
\begin{insertcode}
y
\end{insertcode}
\end{paracol}
\end{document}
Each of the modifications below (magically in some cases) make the warnings go away:
- not using mdframed
- changing the document type from book to minimal (for ex.)
- shifting one of the listings a bit lower by placing some text above it in the column
Edited: made the example simpler, deleted PS (thanks to egreg)
UPDATE: I've just submitted this on the github of mdframed.
