Pandoc: Option clash for package fontspec

Created on 5 Feb 2018  路  7Comments  路  Source: jgm/pandoc

Generating Beamer slides using Pandoc 2.1.1 and XeLaTex plus the Metropolis theme results in a TeX error: option clash for package fontspec.

MWE:

<!-- xxx.md -->
---
title: test
...

# First Slide

wuppie.

pandoc -t beamer --pdf-engine=xelatex -V theme:metropolis -o xxx.pdf xxx.md would produce

Error producing PDF.
! LaTeX Error: Option clash for package fontspec.

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

l.91 }
pandoc -v

pandoc 2.1.1
Compiled with pandoc-types 1.17.3, texmath 0.10.1, skylighting 0.6
Default user data directory: /home/cagix/.pandoc
Copyright (C) 2006-2018 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

However, Pandoc 2.1.1 and XeLaTeX plus the default theme or PDF-LaTeX plus the Metropolis theme
pandoc -t beamer --pdf-engine=pdflatex -V theme:metropolis -o xxx.pdf xxx.md and
pandoc -t beamer --pdf-engine=xelatex -o xxx.pdf xxx.md are working as expected.

Using Pandoc 1.19.2.1 even pandoc -t beamer --latex-engine=xelatex -V theme:metropolis -o xxx.pdf xxx.md works.

Most helpful comment

I just had the problem too, with pandoc 2.1.3, texlive 2016 from debian stable (stretch), and beamertheme-metropolis 1.1 (from the texlive-latex-extra debian package).

After investigation, the problem arises because the package unicode-math in the latex/beamer pandoc template loads fontspec (without any option) before metropolis, and metropolis v1.1 does not check that and loads it again with the option no-math, wich clashes with the first load. This is fixed in metropolis 1.2, see https://github.com/matze/mtheme/pull/243/files

I suppose it is simpler to upgrade a simple package (beamertheme-metropolis) rather than the whole texlive install, especially on debian/ubuntu.

Finally and to make things clear, there is no need to re-open the issue, I just thought it might be useful to explain what I could figure out.

All 7 comments

WFM with XeTeX 3.14159265-2.6-0.99998 (TeX Live 2017/W32TeX). Are you sure you are not using old LaTeX template or old TeX Live or such?

Using the current Pandoc templates (as included in pandoc). Working on Ubuntu 16.04 LTS, i.e.

  • Metropolis: from texlive-latex-extra 2015.20160320-1 (xenial)
  • Xelatex: texlive-xetex 2015.20160320-1ubuntu0.1

To me it seems the merged template. In 1.19.x there was a separate beamer template, which was merged into the latex template in 2.1.x ....

@cagix are you saying this issue can be closed or still not working with newest TeX and template?

Well, using the latest Ubuntu LTS (i.e. 16.04) and Pandoc 2.1.1 plus the current default templates this issue still exists.

However, given that the next LTS is scheduled for end of april and given comment https://github.com/jgm/pandoc/issues/4349#issuecomment-363115882 (newer Xelatex versions seem to work) may be the best option would be to just wait?

Is there any definition/requirement spec of the minimum Tex version one should have to use Pandoc?

I guess newer TeX is better :) other than that I don't think so... but it sounds like a problem with the metropolis theme in combination with older TeX versions... however, if you tell us exactly how the TeX output generated by pandoc should be adjusted we certainly could consider that to support older version, but probably it's not worth the hassle.

I just had the problem too, with pandoc 2.1.3, texlive 2016 from debian stable (stretch), and beamertheme-metropolis 1.1 (from the texlive-latex-extra debian package).

After investigation, the problem arises because the package unicode-math in the latex/beamer pandoc template loads fontspec (without any option) before metropolis, and metropolis v1.1 does not check that and loads it again with the option no-math, wich clashes with the first load. This is fixed in metropolis 1.2, see https://github.com/matze/mtheme/pull/243/files

I suppose it is simpler to upgrade a simple package (beamertheme-metropolis) rather than the whole texlive install, especially on debian/ubuntu.

Finally and to make things clear, there is no need to re-open the issue, I just thought it might be useful to explain what I could figure out.

Was this page helpful?
0 / 5 - 0 ratings