3

I am facing a weird error when compiling a document. I am working for some time now on this doc and faced these problems some time after updating my texlive 2018 installation via tlgmr.

This MWE reproduces the error for me:

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

(it continues on)

When I comment out either hyperref or one of the makeautoquote lines or change the documentclass to article everything compiles fine.

6
  • 2
    \MakeAutoQuote*{>}{<} is just too risky. It redefines < and > to be active characters, which means that they are not interpreted as usual < and > chracters, but as macros. All other code that uses < and > can potentially break, in particular \ifnums. I can get the example to compile if I move the \MakeAutoQuotes to after \begin{document}, but there is no guarantee that things won't break again. Related tex.stackexchange.com/q/472382/35864, tex.stackexchange.com/q/371418/35864
    – moewe
    Mar 1, 2019 at 11:45
  • Thank you for your insightful comment (as usual). It seems to me then that the use aof active quotation environments is rather limited, which leads to using \enquote{} oder \enquote*{} again. Mar 1, 2019 at 12:07
  • 1
    The trick is to find the right characters for \MakeAutoQuote. The \MakeAutoQuote{»}{«} should be working fine, because it is fair to assume that no code uses » and « in ways that could break. But < and > are used all over the place and so redefining them is risky. The entire ASCII range is probably already 'taken', so that you don't want to use any of those characters. gusbrs' discussion in tex.stackexchange.com/q/472382/35864 showed some alternatives, but then you need to be able to produce those characters with your keyboard and editor. ...
    – moewe
    Mar 1, 2019 at 12:12
  • ... That's why I always stuck with \enquote and \enquote*. You can probably configure your editor to insert them for you with a shortcut and so you don't lose that much compared to \MakeAutoQuote.
    – moewe
    Mar 1, 2019 at 12:13
  • 1
    As moewe says, the trick is to find the right characters. Guillemets and curved quotes are pretty safe, as far as I know. \enquote and \enquote* work, of course, but I prefer the active characters for the sake of readability alone (not to mention input). Another thing not mentioned here, but dealt with in the link provided by moewe is whether to use both levels of active characters (outer and inner), or just the first (outer). I'd go for the later. I use \MakeAutoQuote{“}{”} for outer quotes and \enquote*{...} for inner ones. Which is a good balance, imho.
    – gusbrs
    Mar 1, 2019 at 12:43

1 Answer 1

3

The problem is, that \MakeAutoQuote*{<}{>} makes < and > active and redefines them. So every usage of < or > in comparisons like \ifnum … < … \else … \fi will fail after this change. So it is always dangerous, i. e., if such code is read after language selection has been done, e.g.:

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

If you nevertheless use quote characters < and >, you should avoid late loading of packages or configuration or driver files etc., which is not easy or possible in any case.

In your case the problem is the implicit loading of bookmark via \AtBeginDocument. So you could try either:

\documentclass[]{scrartcl}

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

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

or

\documentclass[bookmarkpackage=false]{scrartcl}

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

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

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

However, \MakeAutoQuote*{<}{>} is still dangerous and could make trouble. So I would recommend to not use it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .