csquotes, hyperref und scrartcl erzeugen mehrere Fehler, wenn \makeautoquote und \makeautoquote* verwendet werden

csquotes, hyperref und scrartcl erzeugen mehrere Fehler, wenn \makeautoquote und \makeautoquote* verwendet werden

Beim Kompilieren eines Dokuments tritt ein seltsamer Fehler auf. Ich arbeite seit einiger Zeit an diesem Dokument und hatte diese Probleme einige Zeit, nachdem ich meine Texlive 2018-Installation über tlgmr aktualisiert hatte.

Dieses MWE reproduziert den Fehler für mich:

\documentclass[]{scrartcl}

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

\usepackage{hyperref}

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

Fehler:

(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}

(es geht weiter)

hyperrefWenn ich eine der Zeilen auskommentiere makeautoquoteoder die Dokumentklasse ändere, wird articlealles ordnungsgemäß kompiliert.

Antwort1

Das Problem ist, dass und \MakeAutoQuote*{<}{>}aktiviert und neu definiert werden. Daher schlägt jede Verwendung von oder in Vergleichen wie nach dieser Änderung fehl. Dies ist also immer gefährlich, wenn solcher Code gelesen wird, nachdem die Sprachauswahl vorgenommen wurde, z. B.:<><>\ifnum … < … \else … \fi

\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}

Wenn Sie dennoch Anführungszeichen <und verwenden >, sollten Sie das späte Laden von Paketen oder Konfigurations- oder Treiberdateien usw. vermeiden, was ohnehin nicht einfach oder möglich ist.

In Ihrem Fall ist das Problem das implizite Laden von bookmarkvia \AtBeginDocument. Sie können also Folgendes versuchen:

\documentclass[]{scrartcl}

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

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

oder

\documentclass[bookmarkpackage=false]{scrartcl}

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

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

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

Es ist jedoch \MakeAutoQuote*{<}{>}immer noch gefährlich und könnte Probleme verursachen. Ich würde daher empfehlen, es nicht zu verwenden.

verwandte Informationen