2

The following MWE compiles without problems

\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{fancyvrb}

\begin{document}
\SaveVerb{x>y}|x > y|

\begin{equation*}
\UseVerb{x>y}
\end{equation*}
\end{document}

but if I replace the option english by spanish in babel, I got the following error:

$ pdflatex test.tex
! Missing \endcsname inserted.
<to be read again> 
                   \unhbox 
l.10 \UseVerb{x>y}

I can fix the issue removing > from the name used in the \SaveVerb macro, that is, \SaveVerb{xy}|x > y|, but I want to know if there is a better solution.

4

The problem is that spanish for babel makes < > active characters; you can use the es-noquoting option:

\usepackage[spanish,es-noquoting]{babel}

as in

\documentclass{article}
\usepackage[spanish,es-noquoting]{babel}
\usepackage{amsmath}
\usepackage{fancyvrb}

\begin{document}
\SaveVerb{x>y}|x > y|

\begin{equation*}
\UseVerb{x>y}
\end{equation*}
\end{document}

but then you loose the automatic quotation features implemented by the module through those characters (though the quotating environment can still be used); another option would be to locally deactivate these features and then restore them:

\documentclass{article}
\usepackage[spanish]{babel}
\usepackage{amsmath}
\usepackage{fancyvrb}

\begin{document}
\deactivatequoting
\SaveVerb{x>y}|x > y|

\begin{equation*}
\UseVerb{x>y}
\end{equation*}
\activatequoting
\end{document}
  • @AndrésSicard-Ramírez You're welcome! – Gonzalo Medina Apr 14 '13 at 1:32
1

You can redefine the commands to sanitize their argument:

\documentclass{article}
\usepackage[spanish]{babel}
\usepackage{amsmath}
\usepackage{fancyvrb}
\let\xSaveVerb\SaveVerb
\def\SaveVerb#1{\xSaveVerb{\detokenize{#1}}}
\let\xUseVerb\UseVerb
\def\UseVerb#1{\xUseVerb{\detokenize{#1}}}
\begin{document}
\SaveVerb{x>y}|x > y|

\begin{equation*}
\UseVerb{x>y}
\end{equation*}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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