jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.35k stars 3.37k forks source link

Latex classoption with underbar ('_') is escaped #9262

Open ujtwr opened 10 months ago

ujtwr commented 10 months ago

Underbars are escaped in tex files when class options contain them.

Example:

classoption:

In the tex file:

\documentclass[head\_space=10cm]{jlreq}

the underbar ('') is escaped to '\'

Some of the margin options like "head_space" or "column_gap" in the lualatex class file "jlreq" for Japanese include underscores.

https://www.tug.org/texlive//Contents/live/texmf-dist/doc/latex/jlreq/jlreq-ja.html

jgm commented 10 months ago

If you pass this in as a variable, not as metadata, then it won't be escaped. Metadata values are always parsed as markdown and then escaped when rendered as LaTeX (e.g. when interpolated in a template).

Try -Vclassoption='head_space=10cm' on the command line, or in a defaults file:

variables:
  classoption:
  - 'head_space=10cm'
jgm commented 10 months ago

Or, if you really want to use metadata, specify that the string is raw latex:

  classoption:
  - `head_space=10cm`{=latex}

I think this can be closed.