I read the excellent question Difference between ref, varioref and cleveref. Decision for a thesis and various doc on the net (the varioref package documentation) and tried to use it… but with many errors
An exemple :
\documentclass{article}
\usepackage[a4paper]{geometry}
\geometry{top=25mm,bottom=25mm,inner=25mm,outer=20mm,,marginparwidth=1cm,marginparsep=10pt}
\usepackage[ansinew]{inputenc}
\usepackage[french]{babel}
\usepackage[lmodern]
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage{color,xcolor}
\ifpdf%
\usepackage[pdftex,pagebackref=true,hyperindex=true,colorlinks=true]{hyperref}
\hypersetup{pdfstartview={FitH}, bookmarksnumbered={true}}
\else%
\usepackage[hypertex=true,hyperindex=true,colorlinks=false]{hyperref}
\fi
\usepackage{cleveref}
\usepackage{varioref}
\usepackage{lipsum}
\begin{document}
\section{Bla bla}\label{sec:bla}
\lipsum[1]
\newpage
\section{Second bla bla}
Test section 1 :
\begin{itemize}
\item with \verb"\ref" : \ref{sec:bla}
\item with \verb"\vref" : \vref{sec:bla}
= error "!Missing \verb"\endcsname" inserted"
\item with \verb"\cref" : \cref{sec:bla}
= error "!Missing \verb"\endcsname" inserted"
\end{itemize}
\newpage
\section{Third bla bla}
Test section 1 :
\begin{itemize}
\item with \verb"\ref" : \ref{sec:bla}
\item with \verb"\vref" : \vref{sec:bla}
= error "!Missing \verb"\endcsname" inserted"
\item with \verb"\cref" : \cref{sec:bla}
= error "!Missing \verb"\endcsname" inserted"
\end{itemize}
\end{document}
I get the error !Missing \endcsname inserted
and more other after… (same error with vref as for cref.
How is it possible to resolve this ? I don't find an answer on this forum nor on the net.
I will use those packages (vref
and cref
) for my customized environnements, for exemple with such a macro-box :
\newtheorem{theoreme}{{\sffamily Théorème}}[section]
\newcommand{\boxthm}[2]
{{\colorbox{yellow}{\begin{minipage}{0.98\linewidth}
\begin{theoreme}\label{thm:#1}
{\sffamily ~\\#2}
\end{theoreme}
\end{minipage}}}\\~}
I presume that if I can resolve the problem for a section, I also get the tip for all my macro-boxes (thm, definitions, algorithms, lemma, examples, …) ?
Best Answer
The problem is that
varioref
andcref
don't likebabel
shorthands in the labels. Since the colon has a special meaning for French, you get that strange errors.Some notes. The packages
ae
andaeguill
are really obsolete and don't have really good metric files.Better use the Type1 fonts that are provided by the CM-Super package (it depends on what distribution you're using how you install them) or say