0

I am using fancyref and babel together in a LaTeX document and redefine the label for the equation references by \renewcommand{\frefeqname}{Eq.}, so that they look something like "Eq. (3.4)". However, when I have a foreign language section somewhere like \begin{otherlanguage}{german} ... \end{otherlanguage} then \frefeqname is reset to its default value for English, namely equation. Of course, I can redefine \frefeqname afterwards again, but is quite ugly and I would prefer a clean solution to this problem.

3

The babel package uses \caption<language> to change the caption texts. This macro is called in \selectlanguage or environment otherlanguage. Therefore the redefinitions should be placed in these language macros. It can be done by babel's \addto:

\addto\captionsenglish{%
  \renewcommand*{\frefeqname}{Eq.}%
}

Or the interface of package fancyref can be used, it provides \fancyrefaddcaptions for this purpose, see the documentation of fancyref.

\documentclass{article}
\usepackage[german,english]{babel,fancyref}

\fancyrefaddcaptions{english}{%
  \renewcommand*{\frefeqname}{Eq.}%
}
\fancyrefaddcaptions{german}{%
  \renewcommand*{\frefeqname}{Gl.}%
}

\begin{document}
  \noindent
  \fref{eq:einstein} and \fref{eq:velocity}.
  \begin{equation}
    E=mc^2 \label{eq:einstein}
  \end{equation}
\begin{otherlanguage}{german}
  \fref{eq:einstein} und \fref{eq:velocity}.
  \begin{equation}
    v=\frac st \label{eq:velocity}
  \end{equation}
\end{otherlanguage}
  \fref{eq:einstein} and \fref{eq:velocity}.
\end{document}

Language dependent <code>\frefeqname</code>

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.