3

Putting a math element into an org mode headline causes latex to complain. ie

* This contains $\prod_{k=1}^N$ math
Lorem ipsum

gives

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


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\prod@' on input line 29.


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\slimits@' on input line 29.


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `subscript' on input line 29.


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `superscript' on input line 29.

Rusi
  • 329
  • 2
  • 13
  • Ok I seem to have found the answer hidden in the org mode mailing list: https://list.orgmode.org/olu4mtn48ve.fsf@med.uni-goettingen.de/T/#m069b22b7e10ad6d967fc535c722f4dc52ba41b40 Will see if I can clean it up with a macro and post answer – Rusi Apr 11 '22 at 10:33
  • @NickD Its rendered but it has hyperref/inputenc related errors – Rusi Apr 11 '22 at 11:51
  • Ok just now Im only getting the warnings not the full errors. Will need to see what (other environments?) were upgrading to errors – Rusi Apr 11 '22 at 11:59
  • See also https://tex.stackexchange.com/questions/10555/hyperref-warning-token-not-allowed-in-a-pdf-string – NickD Apr 12 '22 at 06:14

1 Answers1

2

After posting I found a reference in the Org mode mailing list showing how to get round this issue.

Following: the first headline shows org developer Nicolas Goaziou's solution. The second shows how to tighten it a bit with an org mode macro mt which takes math ($$ implied) in arg-1 and equivalent ASCII in arg-2 to keep hyperref happy.

#+MACRO: mt @@latex:\texorpdfstring{$ $1 $}{$2}@@
# mt = math-text
* This contains @@latex:\texorpdfstring{$\prod_{k=1}^N$}{product 1toN}@@ math
Lorem ipsum
* This is better {{{mt(\prod_{k=3}^N,product 1toN)}}} math
Dolor sit amet.
Rusi
  • 329
  • 2
  • 13