2

I'm using the classicthesis package and I created some tikz pictures in the margin using \marginpar. Unfortunately the numbering of the figures is not correct. When I comment out the classicthesis package the numbering is correct. I created a MWE to show my problem

\documentclass{scrreprt}
\usepackage{classicthesis} 
\PassOptionsToPackage{ngerman,main=UKenglish}{babel}   % change thi
\usepackage{babel}                  
\usepackage{biblatex}
\usepackage{caption}
\usepackage{tikz}

\begin{document}
\marginpar{
   \begin{tikzpicture} 
     \draw[->] (0,0) -- (2,2);
   \end{tikzpicture}
 \captionof{figure}{lalalallalalalal .}
 \label{fig1}
}
see fig \ref{fig1} and fig \ref{fig2}

\marginpar{
  \begin{tikzpicture} 
    \draw[->] (0,0) -- (2,2);
  \end{tikzpicture}
  \captionsetup{type=figure}
  \caption{lalalallalalalal .}
  \label{fig2}
}
\end{document}

And I get: Wrong figure numbers

I'm using TeX Live 2015 on a Mac! Has somebody any idea how to fix this? Thanks in advance!

1
  • Just to demonstrate that '\captionsetup' and '\captionof' doesnt make a difference. – hansgans Jul 10 '16 at 8:15
1

Use the marginnote package and its eponymous command \marginnote.

2

Each marginpar is set twice to allow for possibly different settings in left and right margin. But you could reset the counter so it does not jump by two each time:

enter image description here

\documentclass{scrreprt}
\usepackage{classicthesis} 
\PassOptionsToPackage{ngerman,main=UKenglish}{babel}   % change thi
\usepackage{babel}                  
\usepackage{biblatex}
\usepackage{caption}
\usepackage{tikz}
\newcounter{zzz}

\begin{document}
\setcounter{zzz}{\value{figure}}%
\marginpar{\setcounter{figure}{\value{zzz}}%
   \begin{tikzpicture} 
     \draw[->] (0,0) -- (2,2);
   \end{tikzpicture}
 \captionof{figure}{lalalallalalalal .}
 \label{fig1}
}
see fig \ref{fig1} and fig \ref{fig2}

\setcounter{zzz}{\value{figure}}%
\marginpar{\setcounter{figure}{\value{zzz}}%
  \begin{tikzpicture} 
    \draw[->] (0,0) -- (2,2);
  \end{tikzpicture}
  \captionsetup{type=figure}
  \caption{lalalallalalalal .}
  \label{fig2}
}
\end{document}

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.