
Я столкнулся со странной ошибкой при компиляции документа. Я работаю над этим документом уже некоторое время и столкнулся с этими проблемами некоторое время спустя после обновления моей установки texlive 2018 через tlgmr.
Этот 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
или изменяю documentclass на , 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}
Если вы все же используете символы кавычек <
и >
, вам следует избегать поздней загрузки пакетов, файлов конфигурации или драйверов и т. д., что в любом случае непросто и невозможно.
В вашем случае проблема в неявной загрузке bookmark
via \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*{<}{>}
это все еще опасно и может создать проблемы. Поэтому я бы рекомендовал не использовать его.