I have problems getting fancyref
to properly work for German together with the fontspec/polyglossia set-up.
This is the bare set-up without any language settings:
\documentclass{scrartcl}
\usepackage{fontspec}
\usepackage{fancyref}
\begin{document}
Das ist ein deutscher Text
\begin{figure}
\centering
Das soll eine Abbildung sein
\label{fig:sample}
\caption{Beispiel-Abbildung}
\end{figure}
\pagebreak
Das ist die zweite Seite mit einem Verweis auf \fref{fig:sample}.
\end{document}
The interesting thing is and will be the result of the fref
which refers to the figure "on the preceding page".
In this initial stage the figure is numbered as "Figure 1" and the reference reads "figure on the preceding page".
Adding
\usepackage{polyglossia}
\setmainlanguage{german}
will change the caption to "Abbildung 1" (which is correct) and the reference to "abbildung on the preceding page". Note the lowercase "a" in "abbildung", which is not correct, although it's notable that the reference uses the German word at all.
According to the fancyref
manual this should be set to German with
\usepackage{german}
\usepackage[german]{fancyref}
However, this results a) in the error message "! You haven't defined the language [ yet." and b) the text "]german" to be included at the beginning of the document.
If I remove \setmainlanguage{german}
the reference reads "figure auf der vorherigen Seite".
If I remove \usepackage{german}
it reads "Abbildung on the preceding page"
I am completely confused about all this. What do I need for a German document with LuaLaTeX and fontspec
and German fancyref
references?
german
is obsolete and should not be used in newer documents.fancyref
's manual is from 1999. However, without it (at least with my attempts so far)fancyref
will not use the German labels. It will translate "figure" with "Abbildung" but not "on the preceding page" (and all other reference texts).\usepackage[german]{babel}\usepackage[german]{fancyref}
works (I would prefer babel anyway), but the problem is that fancyref doesn't have declarations for ngerman, so you would have to add them. Using some newer package as egreg suggested is certainly better.babel
together withfontspec
was obsolete? That's obviously not true? However, I'll have a look at the newer package(s), even if that means to review >150 pages of an existing document.babel
together withfontspec
is obsolete. Several years ago (5, maybe, and probably more), there was a phase whenbabel
andluatex
didn't get along. However, unless your TeX distribution is positively ancient, this should be no longer be of any concern.