I'm writting in French so I use babel
. I'd like to use prettyref
to keep from writting "Section" and co.
The problem is that I can not use it with French babel
. It throws me:
! Paragraph ended before \@prettyref was complete.
<to be read again>
\par
l.36
?
Here is an MWE:
\documentclass{article}
\usepackage{prettyref}
% Form package, just for info.
\makeatletter
\def\prettyref#1{\@prettyref#1:}
\def\@prettyref#1:#2:{%
\expandafter\ifx\csname pr@#1\endcsname\relax%
\PackageWarning{prettyref}{Reference format #1\space undefined}%
\ref{#1:#2}%
\else%
\csname pr@#1\endcsname{#1:#2}%
\fi%
}
\makeatother
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\begin{document}
\section{Introduction}\label{sec:intro}
See \prettyref{fig:defs}
\section{Definitions}\label{sec:defs}
See \prettyref{sec:conclusion}
\section{Conclusion}\label{sec:conclusion}
See \prettyref{sec:intro} and \prettyref{fig:defs}. With prettyref we simply write \verb|\prettyref{sec:intro}| to get \prettyref{sec:intro}.
\end{document}
Conclusion
Ok ! For all French peaple looking here, you can't define labels like fig:a
. This causes problems as soon as an automatic reference package is used.
The reason is that the :
"letter" becomes an active character in French babel
, which leads all these problems :s
What I made is to use cleveref
with labels like fig-a
.
Thanks everyone !
prettyref
is simply not compatible withbabel-french
. – egreg Feb 11 '20 at 11:06:
– daleif Feb 11 '20 at 11:07:
in labels, even underbabel-french
. I recommend against using:
with this setup though, precisely because of packages likecleveref
that don't like it when active. – frougon Feb 11 '20 at 12:02