8

I am new to pandoc and using it to convert set of markdown files into pdf. I would like to change the default fonts for the pdf.

The documentation gives an example to set the fonts

pandoc -N --template=mytemplate.tex --variable mainfont=Georgia --variable 
sansfont=Arial --variable monofont="Bitstream Vera Sans Mono" --variable 
fontsize=12pt --variable version=1.10 README --latex-engine=xelatex --toc 
-o example14.pdf

however this uses xelatex and it is recommended to use MiKTeX.

I have tried the above with MiKTeX, but without any success.

Is there a way to set the font, I am using Windows 8 with MiKTeX

resp78
  • 1,414
  • 16
  • 37

2 Answers2

2

MiKTeX is a TeX distribution that includes the LaTeX macro package (including the pdflatex and xelatex engines). (Its support for the ConTeXt macro package is apparently not so good though.) If you need unicode support, pdflatex is not such a great choice, so you might want to use xelatex instead.

Use pandoc -D latex to look at the template, save that as myTemplate.tex, modify the file and use for example:

pandoc --template myTemplate.tex --latex-engine xelatex -o output.pdf input.md
mb21
  • 34,845
  • 8
  • 116
  • 142
  • If I get you, you are suggesting to first convert to .tex and then to pdf. And how would I set the fonts whilst generating the .tex? – resp78 Sep 03 '14 at 11:49
  • @MiKTeX After having taken a second look at MiKTeX, I corrected my answer. – mb21 Sep 04 '14 at 19:26
  • Thanks for your suggestion, I have shifted my focus on using Context. It seems much easier and have already created a template to be used with pandoc. Thanks – resp78 Sep 10 '14 at 12:59
  • Great, I find ConTeX also a lot cleaner because all basic layout functionality is in the core instead of a hundred packages. Feel free to accept/upvote my answer then. – mb21 Sep 10 '14 at 14:59
0

I have tried the above with MiKTeX, but without any success.

At a closer look I found that MiKTex is indeed supported, the issue was with fontspec. Once I ran the update fontspec for updated and it started working.

resp78
  • 1,414
  • 16
  • 37
  • Can you expand on this? What is the change to the command line options and also the template? I just want to use a sans-serif font for my PDF using miktex, and I don't even know where to start. – CMCDragonkai Mar 09 '20 at 14:38
  • Sorry, I don't remember, I did this 6 years back and it was a side project for me. I am not really an expert in these things. – resp78 Mar 11 '20 at 02:29