Hyperref + Silence + inline maths, doesn't compile

by tecosaur   Last Updated September 11, 2019 16:23 PM - source

Issue

Document compilation hangs when \( ... \) in section title etc. if both hyperref and silence are loaded.

MWE

\documentclass{article}

\usepackage{silence}
\usepackage{hyperref}

\title{Title}
\author{Author}

\begin{document}

\maketitle

\section{Hi \(a + b = c\)}

\end{document}

Where compilation hangs

Compilation output ends like so

...
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty))
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(./temp.aux) (/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))


Answers 2


Simply do not use package silence. This package is latest updated in 2012 and there have been a lot of changes in LaTeX packages!

To find errors in your compiled document it is important you can see all errors and warnings and additional informations to be able to recognize errors you can simply not see in the generated pdf!

Mensch
Mensch
September 11, 2019 15:51 PM

It seems that the workaround suggested in https://tex.stackexchange.com/a/103486/4427 avoids the loop.

However, the bookmark will contain spurious items, so it's much better to exploit \texorpdfstring.

\documentclass{article}

\usepackage{silence}
\usepackage{hyperref}

\makeatletter
\protected\def\[email protected]{\[email protected]}
\makeatother

\title{Title}
\author{Author}

\begin{document}

\maketitle

\section{Hi \(a + b = c\)}

\section{Hi \texorpdfstring{\(a + b = c\)}{a+b=c}}

\end{document}

enter image description here

I'd keep the workaround just in order to avoid infinite loops, but, as you see, the bookmark is wrong for the first case.

egreg
egreg
September 11, 2019 16:06 PM

Related Questions



Filtering hyperref warning

Updated October 06, 2019 01:23 AM