2

Problem/Question

I'm encountering problem using \autoref (from hyperref package) to reference a scheme-environment (provided chemstyle package), when using \includegraphics[*]{*.eps} (working with auto-pst-pdf package), as it will omitt "Scheme" in the typesetted reference.

Is this an known issue, and is there any way to bypass this problem?

I already tried to use

  \def\schemeautorefname{Scheme}

in preamble - without any succes.

M(N)WE

\documentclass{article}

\RequirePackage[runs=2,crop=off]{auto-pst-pdf}
\RequirePackage[varioref=false]{chemstyle}
\RequirePackage{hyperref}

\begin{document}
%usage on an .eps file
\begin{scheme}[H]
    \centering
    \caption{Caption}
    \includegraphics{./EPS.eps}
    \label{schm:test1}
\end{scheme}
Test \autoref{schm:test1}... (Not working)
%usage on an .png file
\begin{scheme}[H]
    \centering
    \caption{Caption}
    \includegraphics{../PNG.png}
    \label{schm:test2}
\end{scheme}
Test \autoref{schm:test2}... (Working)
\end{document}
2

You have put \label after \includegraphics. In the case of .eps files, package auto-pst-pdf sets an anchor (pspicture.1) for the graphics. This anchor (pspicture.1) is then used by \label instead of the anchor set by the \caption (scheme.caption.1).

Solution: \label belongs right after \caption:

\begin{scheme}[H]
    \centering
    \caption{Caption}
    \label{schm:test1}
    \includegraphics{./EPS.eps}
\end{scheme}

\begin{scheme}[H]
    \centering
    \caption{Caption}
    \label{schm:test2}
    \includegraphics{../PNG.png}
\end{scheme}
  • ...working like a charm!! Thank you very very much, I'd never had thought about that :) So it's recomended, or even needed to have \label directly after \caption? Is there a convention (or does it make a difference) to put this block before or after the \includegraphics command? – lcnittl Jun 4 '14 at 5:08
  • 1
    @lcnittl: Often captions go below figures and above tables. – Heiko Oberdiek Jun 4 '14 at 5:19

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.