Wandmalfarbe / pandoc-latex-template

A pandoc LaTeX template to convert markdown files to PDF or LaTeX.
BSD 3-Clause "New" or "Revised" License
6.22k stars 968 forks source link

Source Sans Pro isn't applied as a main font family when using XeLaTeX #8

Closed iandol closed 6 years ago

iandol commented 7 years ago

Hi, if I supply a lang: en-GB or lang: en-US metadata field to your custom-titlepage example, the main body text is not source sans pro any more, but the latex default:

screen shot 2017-05-31 at 17 16 25

removing it and all is fine...

---
title: "Vinaque sanguine metuenti cuiquam Alcyone fixus"
author: [Author Name]
date: 2017-02-20
subject: "Markdown"
tags: [Markdown, Example]
subtitle: "Aesculeae domus vincemur et Veneris adsuetus lapsum"
titlepage: true
titlepage-color: eeeeee
titlepage-text-color: ffffff
titlepage-rule-color: ffffff
titlepage-rule-height: 1
lang: en-GB
...
iandol commented 7 years ago

I see the same error if I use -V lang=en-GB at the command line...

Wandmalfarbe commented 7 years ago

I can't reproduce this. Could you give me the complete command that you used to generate the PDF? You could also check if the package sourcesanspro is installed on your system with:

kpsewhich sourcesanspro.sty

I recently changed the default language of the template... maybe I already fixed it.

iandol commented 7 years ago

Hi, I'm currently using TeXLive2017 basic on macOS, and do have sourcesanspro installed (also have it installed as a system font). I get no errors on compile using this (I've redownloaded eisvogel.latex and custom-titlepage.md to the latest versions), still not working:

👉  kpsewhich sourcesanspro.sty
/usr/local/texlive/2017basic/texmf-dist/tex/latex/sourcesanspro/sourcesanspro.sty
👉  pandoc -t latex -o out.tex --template=eisvogel.latex -V lang=en-GB custom-titlepage.md
👉  latexmk -time -f -pv -xelatex out.tex;

Here are the LaTeX source file and log: https://gist.github.com/iandol/b6b7667bc6c29abcbfdb7f754f6a012e

If you can't figure out why, we can close this as it is probably a LaTeX bug. I will rewrite your template to use \setmainfont \setsansfont etc. using my system installed fonts...

Wandmalfarbe commented 7 years ago

Okay, I can reproduce this even with pandoc:

pandoc "custom-titlepage.md" -o "custom-titlepage.pdf" --from markdown --template eisvogel.latex --latex-engine=xelatex

When I change the engine to pdflatex, the font gets applied normally. I really don't know what's causing the font to change when using xelatex.

At least I found out that you can load the package sourcesanspro with the option default that applies the font as the default font family. Unfortunately this does not fix the problem.

nextlevelshit commented 7 years ago

In my case it did not had anything to do with the latex engine. There were only missing the right texlive extensions:

sudo apt-get install texlive-fonts-recommended texlive-fonts-extra

That line of code did the job. I am using Ubuntu Gnome 17.04.

Wandmalfarbe commented 7 years ago

@nextlevelshit Thank you for your suggestion. I hope that will be useful for all Ubuntu users out there.

On OS X/macOS I checked the installed packages and the needed packages sourcesanspro, sourcecodeproand sourceserifpro are definitely installed (tlmgr info <packagename>).

The current workaround on macOS would be to use setmainfont and mainfontoptions in the YAML metadata block

---
title: "Example PDF"
author: [Author]
date: 2017-02-20
subject: "Markdown"
tags: [Markdown, Example]
mainfont: "SourceSansPro-Regular"
mainfontoptions: "Scale=1.0"
...

# Vinaque sanguine metuenti cuiquam Alcyone fixus

or via command line options

pandoc "ex.md" -o "ex.pdf" --from markdown --template eisvogel.latex --latex-engine=xelatex -V mainfont="SourceSansPro-Regular" -V mainfontoptions="Scale=1.0"

. Unfortunately the result looks a bit different.

mriedmann commented 7 years ago

Same issue here with MiKTeX on Win10, pandoc and xelatex. All font packages are installed. Lang is set to de. Workaround helps but a "permanent" solution would be awesome.

> systeminfo
...
Betriebssystemname:                            Microsoft Windows 10 Pro
Betriebssystemversion:                         10.0.10586 Nicht zutreffend Build 10586
...

> latex --version
MiKTeX-pdfTeX  (MiKTeX 2.9.6300)

> pandoc --version
pandoc 2.0.1
Compiled with pandoc-types 1.17.2, texmath 0.9.4.4, skylighting 0.4.2

BTW: Very nice template! I'm pretty new to latex so I can only support you with tests/infos, sorry.

Wandmalfarbe commented 6 years ago

This is an issue in polyglossia (reutenauer/polyglossia#127 and reutenauer/polyglossia#186). I followed the first workaround from jfbz on Tex StackExchange.