Skip to content

Mathematics in section titles cannot be used with pdf rendering if the engine is lualatex #40

@durandg12

Description

@durandg12

I have the section
# Variant proof that $|\cK|\leq 2m-1$ {.appendix .unnumbered}
in my submission, where \cK is a custom command for \mathcal{K}.

In the .tex file generated by the render computo-pdf command this gives the bit

\section*{\texorpdfstring{Variant proof that
\(|\mathcal{K}|\leq 2m-1\)}{Variant proof that \textbar\textbackslash mathcal\{K\}\textbar\textbackslash leq 2m-1}}\label{variant-proof-that-mathcalkleq-2m-1}
\addcontentsline{toc}{section}{Variant proof that
\(|\mathcal{K}|\leq 2m-1\)}

and it produces an error on compilation with lualate. Compilation does not fail when using pdflatex. The error message is the following:

Package hyperref Warning: Token not allowed in a PDF string (Unicode):
(hyperref)                removing `math shift' on input line 2272.


Package hyperref Warning: Token not allowed in a PDF string (Unicode):
(hyperref)                removing `\symcal' on input line 2272.

./algo-curve.tex:2272: Improper alphabetic constant.
<to be read again> 
\leq 
l.2272 \(|\mathcal{K}|\leq 2m-1\)}

Line 2272 of the .tex file is \(|\mathcal{K}|\leq 2m-1\)}.

I think that I found the root cause, I made the following minimal .tex file:

\documentclass[12pt]{article}

\usepackage{hyperref} 

\begin{document}

\tableofcontents

\section*{\texorpdfstring{Variant proof that
\(|\mathcal{K}|\leq 2m-1\)}{Variant proof that \textbar\textbackslash mathcal\{K\}\textbar\textbackslash leq 2m-1}}\label{variant-proof-that-mathcalkleq-2m-1}
\addcontentsline{toc}{section}{Variant proof that
\(|\mathcal{K}|\leq 2m-1\)}

\end{document}

and with this file compilation does not fail with lualatex. However, if I add \usepackage{unicode-math}then I get the same error. The file generated by computo-pdf does not use the unicode-math package in pdflatex mode, hence why there is no error with pdflatex.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions