4

I'm using Pandoc with xetex to attempt to create a pdf from a markdown document.

In the metadata of my document I have the following:

---
documentclass: tufte-handout
classoption: nohyper
---

The full Pandoc command I'm running is:

pandoc ComplexGraphs.md -t latex -f markdown+tex_math_double_backslash -o test.pdf --latex-engine=xelatex

However, this gives the following error:

! LaTeX Error: Option clash for package fontspec.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.67 ...Package[\eu@zf@math]{fontspec}[2008/08/09]

pandoc: Error producing PDF from TeX source

Does anyone have an idea what the problem could be?

  • Does the tufte-handout class call fontspec.sty? The issue could be that Pandoc’s template calls mathspec.sty which in turn calls fontspec.sty with some options when you use xelatex. This can lead to the option clash if you have something else that calls fontspec.sty without options. You could try to use Pandoc without the latex-engine option and see what happens. – twsh Nov 23 '15 at 8:50
  • The same problem doesn't occur, but instead I get the following: ! Argument of \) has an extra }. <inserted text> \par l.92 \end{figure} pandoc: Error producing PDF from TeX source – Cadel Nov 24 '15 at 5:21
  • Nevermind, it seems that was a problem with the markdown source itself. Thanks for the help - I'll just have to find another way to deal with fonts that doesn't use XeTeX. – Cadel Nov 24 '15 at 5:35
  • You could edit the Pandoc LaTeX template: just deleting mathspec.sty and replace it with fontspec.sty might be all you need. (It would be simpler not to if you don't need XeTeX.) – twsh Nov 24 '15 at 10:24
3

Pandoc uses a template which, when used with XeTeX calls mathspec.sty; mathspec.sty calls fontspec.sty with some options. If something else calls fontspec.sty then there will be a clash, and tufte-handout.cls does so. One solution would be to edit the template Pandoc uses. Taking out mathspec.sty would do the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.