# Package classicthesis and tikz figure numbering in marginpar

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:

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

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

Use the marginnote package and its eponymous command \marginnote.

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:

\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}