2

Is there a workaround this problem?

\documentclass[12pt]{book}
\usepackage{amsmath} 
\usepackage{breqn}
\usepackage{hyperref}
\begin{document}

\section{$\frac{\partial\phi}{\partial x}\neq p$ or dAlembert ode} A

\end{document}

And now lualatex foo.tex Gives

....
(/usr/local/texlive/2022/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2022/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
(./foo.out) (./foo.out)
! TeX capacity exceeded, sorry [input stack size=50000].
\neq  ->\math_csym_Rel:Nn \neq 
                               {\not {=}}
l.7 ...ial\phi}{\partial x}\neq p$ or dAlembert ode}

1043 words of node memory still in use: 14 hlist, 2 vlist, 3 rule, 3 mark, 1 disc, 1 local_par, 1 dir, 2 math, 12 gl ue, 11 kern, 2 penalty, 26 glyph, 18 attribute, 67 glue_spec, 18 attribute_list , 4 if_stack, 1 write, 2 pdf_dest nodes avail lists: 2:4,3:6,4:1,5:4,7:2,8:10,9:3 ! ==> Fatal error occurred, no output PDF file produced! Transcript written on foo.log.

Replacing \neq by = it now compiles with no error. Removing breqn also it compiles with no error using \neq in section title. So the problem is due to breqn being loaded.

Any workaround possible?

TL 2022.

Nasser
  • 20,220
  • \texorpdfstring{$\frac{\partial\phi}{\partial x}\neq p$}{something else} – Ulrike Fischer Dec 06 '22 at 09:43
  • @UlrikeFischer I prefer to keep the math there as is and not replace it with text. It works for all the math in section title. It is only \neq that seems to cause the problem. – Nasser Dec 06 '22 at 09:46
  • breqn is incompatible with a lot of things and thus is probably best not used. – daleif Dec 06 '22 at 09:46
  • hyperref will remove/make nonsense out of the math in the bookmarks anyway. Didn't you see (without breqn) all the warnings in the logs? – Ulrike Fischer Dec 06 '22 at 09:48
  • @UlrikeFischer you are right, it is all garbled, I did not notice that. – Nasser Dec 06 '22 at 10:04

1 Answers1

4

That's a minor problem: even if you disable \neq in the bookmarks with

\pdfstringdefDisableCommands{\def\neq{≠}}

you get inscrutable garbage in the bookmark anyway.

enter image description here

Use \texorpdfstring.

\documentclass[12pt]{book}
\usepackage{amsmath} 
\usepackage{breqn}
\usepackage{hyperref}

\begin{document}

\section{\texorpdfstring{$\frac{\partial\phi}{\partial x}\neq p$}{∂φ/∂x≠p} or d'Alembert ode} A

\end{document}

enter image description here

If you hope to do it “automatically”, well, good luck.

egreg
  • 1,121,712