Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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>

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.