pandoc icon indicating copy to clipboard operation
pandoc copied to clipboard

Latex classoption with underbar ('_') is escaped

Open ujtwr opened this issue 1 year ago • 2 comments

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

Example:

classoption: - head_space=10cm

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

ujtwr avatar Dec 17 '23 12:12 ujtwr

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 avatar Dec 17 '23 18:12 jgm

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.

jgm avatar Dec 17 '23 18:12 jgm