Reputation: 1652
I have a markdown document that I convert to PDF via pandoc's latex engine. I'm trying to render an n with a tilde over it, as in "niño", with markdown like the following:
ni\~{n}o
...but this just gets rendered in the PDF as "ni~no" -- i.e. the tilde gets interpreted literally. I've also tried escaping the backslash (ni\\~{n}o
), surrounding everything in brackets (ni{\~{n}}o
), and basically what I think is every possible combination of escaping characters in this sequence, but nothing works. It also fails even when the sequence is on its own (i.e. \~{n}
).
But, other similar sequences that are based on letters rather than symbols work just fine (e.g. Otter\r{a}
gets rendered correctly to "Otterå"). Pandoc is specifically failing to handle the tilde (or maybe more generally non-letter-based latex character sequences -- I haven't tested others).
The command I'm using to build the pdf is pandoc file.md -o file.pdf
. I've also tried specifying -f markdown+raw_tex
, but it still fails (nor should I need to, since the \r{a}
works without it, and I think raw_tex
is enabled by default anyway).
Any thoughts? I know I can use xetex to just enter these characters directly, but that's not really a satisfying solution...
Upvotes: 2
Views: 2551
Reputation: 1652
Besides using the ñ
character directly (which apparently works in native Pandoc because it's magic!), an alternative is to create a simple LaTeX \newcommand
for forcing native TeX interpretation.
\newcommand{\tex}[1]{#1}
ni\tex{\~n}o
Thanks to John McFarlane for introducing me to this clever workaround!
Upvotes: 6