csquotes、hyperref、scrartcl は、\makeautoquote と \makeautoquote* を使用すると複数のエラーを生成します。

csquotes、hyperref、scrartcl は、\makeautoquote と \makeautoquote* を使用すると複数のエラーを生成します。

ドキュメントをコンパイルするときに奇妙なエラーが発生します。私はしばらくこのドキュメントに取り組んでおり、tlgmr 経由で texlive 2018 インストールを更新した後、しばらくしてこれらの問題に直面しました。

この MWE はエラーを再現します:

\documentclass[]{scrartcl}

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

\usepackage{hyperref}

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

エラー:

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

(それは続く)

hyperrefいずれかの行をコメント アウトするかmakeautoquote、ドキュメント クラスを変更すると、articleすべてが正常にコンパイルされます。

答え1

問題は、と をアクティブにして再定義すること\MakeAutoQuote*{<}{>}です。そのため、この変更後、 のような比較でのまたはの使用はすべて失敗します。したがって、言語選択が行われた後にこのようなコードが読み取られる場合は常に危険です。例:<><>\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}

それでも引用符<とを使用する場合は>、パッケージや構成ファイル、ドライバ ファイルなどの遅延読み込みを避ける必要がありますが、これはいずれにしても簡単ではなかったり、不可能だったりします。

あなたの場合、問題はbookmarkviaの暗黙的な読み込みです\AtBeginDocument。したがって、次のいずれかを試すことができます。

\documentclass[]{scrartcl}

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

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

または

\documentclass[bookmarkpackage=false]{scrartcl}

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

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

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

しかし、\MakeAutoQuote*{<}{>}それでも危険であり、トラブルを引き起こす可能性があります。そのため、使用しないことをお勧めします。

関連情報