csquotes, hyperref e scartcl produzem vários erros quando \makeautoquote e \makeautoquote* são usados

csquotes, hyperref e scartcl produzem vários erros quando \makeautoquote e \makeautoquote* são usados

Estou enfrentando um erro estranho ao compilar um documento. Estou trabalhando neste documento há algum tempo e enfrentei esses problemas algum tempo depois de atualizar minha instalação do texlive 2018 via tlgmr.

Este MWE reproduz o erro para mim:

\documentclass[]{scrartcl}

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

\usepackage{hyperref}

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

Erro:

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

(continua)

Quando comento uma hyperrefou uma das makeautoquotelinhas ou altero a documentclass para articletudo compila bem.

Responder1

O problema é que isso os \MakeAutoQuote*{<}{>}torna ativos e os redefine. Portanto, todo uso ou em comparações como falhará após essa alteração. Portanto, é sempre perigoso, ou seja, se tal código for lido após a seleção do idioma ter sido feita, por exemplo:<><>\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}

Mesmo assim, se você usar aspas <e >, deverá evitar o carregamento tardio de pacotes ou arquivos de configuração ou de driver, etc., o que não é fácil ou possível em qualquer caso.

No seu caso, o problema é o carregamento implícito de bookmarkvia \AtBeginDocument. Então você pode tentar:

\documentclass[]{scrartcl}

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

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

ou

\documentclass[bookmarkpackage=false]{scrartcl}

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

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

\begin{document}

\section{Introduction}
test test test

\section{Conclusion}

\end{document}

No entanto, \MakeAutoQuote*{<}{>}ainda é perigoso e pode causar problemas. Então eu recomendaria não usá-lo.

informação relacionada