I am trying to use latex to write something in polish. I am using babel
package together with hyperref
. I thought this would be enough, but apparently it is not.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[polish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\begin{document}
\section{foo}
\label{sec:here}
\begin{figure}
\caption{\label{fig:here} This is a figure caption}
\end{figure}
\autoref{sec:here}
\autoref{fig:here}
\end{document}
This produces:
As you can see the figure caption is correctly written in Polish, but the autoreferences are still in English.
I guess it should be something simple. For example, the question Wrong autoref names when using babel's `main=` feature suggests that the above should work.
All other material I was able to find on stackexchange or google was focusing on more specific uses than the one I am describing.
So, what am I missing?
A possible walkaround I am aware of is to manually define all those names through \def\figureautorefname
, but I hope someone already did that in a public package and is properly maintained.
Best Answer
Unfortunately, support for
Polish
language is not defined inhyperref
for the\...autorefname
macros.hyperref
supportsenglish,afrikaans,french,german,spanish,catalan,portuges,magyar, russian,italian,vietnamese
yet, as of version 6.85a from 2017/03/14.A trial of a solution:
The macro
\ProvidePolishAutoRefNames{figure=\figurename,chapter,section={PolishSectionName},table,equation={PolishEquationName}}
loops through the counter names that are given in a comma separated list and generates the
\##1autorefname
on the fly.If
figure=\figurename
is given, it uses the name from\figurename
etc, if just the counter nameX
is given, it tries to use\Xname
, which is not defined in any case.Since I don't speak Polish, I have used
PolishSectionName
etc. as replacement.A similar version, by defining
\HyLang@polish
analogously toHyLang@french
etc.