2

Related:

MWE:

\documentclass{memoir}

\usepackage{hyperref}
\usepackage{polyglossia}
\setdefaultlanguage{spanish}
\setotherlanguage[variant=british]{english}

\begin{document}
  \begin{figure}
    \caption{Demo}
    \label{fig:demo}
  \end{figure}

  \begin{english}
    \autoref{fig:demo}
  \end{english}

  \begin{spanish}
    \autoref{fig:demo}
  \end{spanish}
\end{document}

MWE image: both references are in English, though Spanish is the main language

I tried the babel macro, but it does not work; adding spanish to hyperref's loading options just changes the problem language.

How can I fix this?

  • Did you also note that \usepackage[spanish]{hyperref} should be loaded after your \setdefaultlanguage etc. commands? – user31729 Feb 21 '17 at 22:24
  • Nope, but it gives the same result (both refs are in Spanish). – amyspark Feb 21 '17 at 23:10
2

You have to add a redefinition of \figureautorefname for Spanish, but also to change it in \blockextras@english.

\documentclass{memoir}

\usepackage{polyglossia}
\usepackage{hyperref}

\setdefaultlanguage{spanish}
\setotherlanguage[variant=british]{english}

\appto\captionsspanish{\renewcommand\figureautorefname{Figura}}
\makeatletter
\appto\blockextras@english{\renewcommand\figureautorefname{Figure}}
\makeatother

\begin{document}

\begin{figure}
\caption{Demo}
\label{fig:demo}
\end{figure}

\begin{english}
\autoref{fig:demo}
\end{english}

\begin{spanish}
\autoref{fig:demo}
\end{spanish}

\end{document}

enter image description here

On the other hand, cleveref works out of the box.

\documentclass{memoir}

\usepackage{polyglossia}
\usepackage{hyperref}
\usepackage{cleveref}

\setdefaultlanguage{spanish}
\setotherlanguage[variant=british]{english}

\begin{document}

\begin{figure}
\caption{Demo}
\label{fig:demo}
\end{figure}

\begin{english}
\Cref{fig:demo}
\end{english}

\begin{spanish}
\Cref{fig:demo}
\end{spanish}

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