\language@active@arg< の引数に余分な } があります

\language@active@arg< の引数に余分な } があります

私は小さなMWEを持っています:

  \batchmode
  \documentclass[twoside]{book}
  \usepackage[spanish]{babel}
\begin{document}
\chapter{Referencia \texorpdfstring{$<$}{<} }
\end{document}

そして、この結果 (pdflatex を使用) は次のエラーになります:

! Argument of \language@active@arg> has an extra }.
<inserted text>
                \par
l.5 \chapter{Referencia \texorpdfstring{$<$}{<} }

I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

Runaway argument?
! Paragraph ended before \language@active@arg> was complete.
<to be read again>
                   \par
l.5 \chapter{Referencia \texorpdfstring{$<$}{<} }

I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
...

これを一般的な方法で解決する方法について何か提案はありますか? (問題は の他の文字でも発生しますtextorpdfstring)

答え1

うーん... MWE を減らしすぎましたね。hyperref同様にロードすべきではないでしょうか? とにかく、<スペイン語の babel ではデフォルトでアクティブになっています。私の解決策は (とにかく Unicode/utf8 エンコードを使用することを前提として) 常に使用することです:

\documentclass[twoside]{book}
  \usepackage[T1]{fontenc}
  \usepackage[spanish, es-noshorthands, shorthands=off]{babel}
  \usepackage{hyperref}
\begin{document}
\chapter{Referencia \texorpdfstring{$<$}{<} }
\end{document}

それはほとんどどこでも機能します。

関連情報