jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.68k stars 3.39k forks source link

Latex command \hypertarget{} not preserved in conversion even with raw_tex enabled #7418

Open bcdavasconcelos opened 3 years ago

bcdavasconcelos commented 3 years ago

Version: Pandoc 2.14.0.3 Command: /usr/local/bin/pandoc -f markdown+raw_tex untitled.md -t latex -o untitled.tex

Markdown source

Lorem \hypertarget{anchor} etc

Lorem \hyperlink{anchor}{the link} etc

Expected output

Lorem \hypertarget{anchor} etc

Lorem \hyperlink{anchor}{the link} etc

Actual output

Lorem \textbackslash hypertarget\{anchor\} etc

Lorem \hyperlink{anchor}{the link} etc

Shouldn't the command \hypertarget, like its counterpart\hyperlink, be preserved with the addition of +raw_tex to the conversion command?

jgm commented 3 years ago

You don't need raw tex for this kind of thing.

% pandoc -t latex
Lorem [etc]{#anchor}

Lorem [the link](#anchor) etc
^D
Lorem \protect\hypertarget{anchor}{}{etc}

Lorem \protect\hyperlink{anchor}{the link} etc
jgm commented 3 years ago

But there's definitely a problem here with the way \hypertarget is being handled.