csquotes, hyperref y scrartcl producen múltiples errores cuando se usan \makeautoquote y \makeautoquote*

csquotes, hyperref y scrartcl producen múltiples errores cuando se usan \makeautoquote y \makeautoquote*

Me enfrento a un error extraño al compilar un documento. Estoy trabajando desde hace algún tiempo en este documento y enfrenté estos problemas algún tiempo después de actualizar mi instalación de texlive 2018 a través de tlgmr.

Este MWE me reproduce el error:

\documentclass[]{scrartcl}

\usepackage[ngerman]{babel}
\usepackage[]{csquotes}
\MakeAutoQuote{»}{«}
\MakeAutoQuote*{>}{<}

\usepackage{hyperref}

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

Error:

(c:/texlive/2018/texmf-dist/tex/latex/oberdiek/bkm-pdftex.def File: bkm-pdftex.def 2016/05/17 v1.26 bookmark driver for pdfTeX (HO) Package auxhook Info: \AddLineBeginMainAux comes a little late, (auxhook)             because the main .aux file is already opened on input lin e 164. \BKM@id=\count107 )) ! Missing = inserted for \ifnum. <to be read again> 
                   \begingroup  l.14 \section{Introduction}
                            I was expecting to see `<', `=', or `>'. Didn't.

! Missing number, treated as zero. <to be read again> 
                   \begingroup  l.14 \section{Introduction}
                            A number should have been here; I inserted `0'. (If you can't figure out why I needed to see a number, look up `weird error' in the index to The TeXbook.)

! Missing = inserted for \ifnum. <to be read again> 
                   \begingroup  l.14 \section{Introduction}
                            I was expecting to see `<', `=', or `>'. Didn't.

! Missing number, treated as zero. <to be read again> 
                   \begingroup  l.14 \section{Introduction}
                            A number should have been here; I inserted `0'. (If you can't figure out why I needed to see a number, look up `weird error' in the index to The TeXbook.)


Package bookmark Warning: Unknown document division name (1) (bookmark)                for option `level' on input line 14.

! Missing = inserted for \ifnum. <to be read again> 
                   \begingroup  l.14 \section{Introduction}
                            I was expecting to see `<', `=', or `>'. Didn't.

! Missing number, treated as zero. <to be read again> 
                   \begingroup  l.14 \section{Introduction}
                            A number should have been here; I inserted `0'. (If you can't figure out why I needed to see a number, look up `weird error' in the index to The TeXbook.)

! Undefined control sequence. \GenericError  ...                      

                                                    #4  \errhelp \@err@     ... l.14 \section{Introduction}
                            The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., `\hobx'), type `I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

! Undefined control sequence. \GenericError  ...                      

                                                  \let \@err@               ... l.14 \section{Introduction}

(continúa)

Cuando comento una hyperrefo una de las makeautoquotelíneas o cambio la clase de documento a articletodo se compila bien.

Respuesta1

El problema es que eso \MakeAutoQuote*{<}{>}los <activa >y los redefine. Por lo tanto, cada uso de <o >en comparaciones como \ifnum … < … \else … \fifallará después de este cambio. Por lo tanto, siempre es peligroso, es decir, si dicho código se lee después de haber seleccionado el idioma, por ejemplo:

\begin{filecontents*}{\jobname1.tex}
  \ifnum \value{page}>0 \relax\fi
\end{filecontents*}
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[]{csquotes}
\MakeAutoQuote{»}{«}
\MakeAutoQuote*{>}{<}
\AtBeginDocument{\input{\jobname1.tex}}
\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

Sin embargo, si utiliza comillas <y >, debería evitar la carga tardía de paquetes o archivos de configuración o controladores, etc., lo cual no es fácil ni posible en ningún caso.

En su caso el problema es la carga implícita de bookmarkvia \AtBeginDocument. Entonces podrías probar cualquiera de las dos opciones:

\documentclass[]{scrartcl}

\usepackage[ngerman]{babel}
\usepackage[]{csquotes}
\usepackage{hyperref}
\usepackage{bookmark}
\MakeAutoQuote{»}{«}
\MakeAutoQuote*{>}{<}

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

o

\documentclass[bookmarkpackage=false]{scrartcl}

\usepackage[ngerman]{babel}
\usepackage[]{csquotes}
\usepackage{hyperref}

\MakeAutoQuote{»}{«}
\MakeAutoQuote*{>}{<}

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

Sin embargo, \MakeAutoQuote*{<}{>}sigue siendo peligroso y podría causar problemas. Por lo que recomendaría no usarlo.

información relacionada