[Tex/LaTex] UTF-8 characters not displayed with xelatex (pandoc)

charactersfontsunicode

I'm using XeLaTeX with pandoc to generate PDFs from markdown files: but the "⇒" character (UTF8) does not get correctly generated (it's not show in the output file). Is it possible to get the "⇒" character converted from markdown to PDF without using $\Rightarrow$?

(I'm already using the xunicode and xlxstra packages)

Best Answer

Pandoc converts the file correctly. If you open the resulting file with a text editor you see the ⇒ symbol, which in turn means that pandoc has done a good job.

The point is that the text font you use (probably Latin Modern) does not contain the ⇒ character. If you change the font to a different one which contains the ⇒ symbol, e.g. iwona, it will appear as expected.

If you want to keep using Latin Modern as bodyfont, here's a small hack which takes the ⇒ symbol from the math font instead (it's a plain TeX solution, maybe LaTeX provides some nice abstraction around this): Place the following code into fixRightarrow.tex:

\catcode`\⇒\active
\def⇒{$\Rightarrow$}

and call pandoc with the --include-before-body argument:

pandoc \
  --include-before-body=fixRightarrow.tex \
  --to=latex                              \
  --output=output.tex                     \
  input.md
Related Question