1

The following code:

\documentclass{scrbook}
% \usepackage{classicthesis}

\newwrite\myauxfile
\immediate\openout\myauxfile=test.myaux

\begin{document}

\begin{figure}
  This is a figure
  \caption{This is a caption}
  \label{fig:1}
\end{figure}
Figure~\ref{fig:1}
\write\myauxfile{Figure \ref{fig:1}}
\end{document}

produces a file test.myaux containing the following line:

Figure \relax 0.1\hbox {}

If I include the classicthesis package (uncommenting the second line) The reference number is not expanded and the file test.myaux contains the following line:

Figure \ref  {fig:1}

which is not what I want. Is it possible to fix this?

1 Answer 1

2

Maybe you want to use \getrefnumber:

\documentclass{scrbook}
\usepackage{classicthesis}
\usepackage{refcount}

\newwrite\myauxfile
\immediate\openout\myauxfile=\jobname.myaux

\begin{document}

\begin{figure}
  This is a figure
  \caption{This is a caption}
  \label{fig:1}
\end{figure}
Figure~\ref{fig:1}
\write\myauxfile{Figure \getrefnumber{fig:1}}
\end{document}

The new aux file will contain

Figure 1
1

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.