sample pandoc-generated PDF font examples
Clone or download
danstoner must reference first field only
The purpose of cut in the previous iteration of the fc-list command was to remove the commas and following portions of the font family name (localized name perhaps?).

Without it, we get output such as:

```
$ fc-list --format="%{family}\n" | sort | uniq | tail -n 1
WenQuanYi Micro Hei,文泉驛微米黑,文泉驿微米黑
```
With the field reference ```[0]``` we get:

```
$ fc-list --format="%{family[0]}\n" | sort | uniq | tail -n 1
WenQuanYi Micro Hei Mono
```

I missed this minor but important difference when first reading @jdhao's suggestion in issue #1.
Latest commit 1a59ac1 May 10, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
samples_pdflatex initial checkin Apr 7, 2015
samples_xelatex initial checkin Apr 7, 2015
.gitignore initial checkin Apr 7, 2015
README.md add wget and other minor edits Apr 9, 2015
fc-list-examples.md must reference first field only May 10, 2017
samplejohndoeresume.md initial checkin Apr 7, 2015

README.md

pandoc_samples

sample PDF files with fonts generated by pandoc

Generating conventional documents (PDF, MS Word, HTML, ...) with pandoc is easy. Use the '-o' option to set the output filename, pandoc will use the file extension to set the output file type.

Example:

$ pandoc -o samplejohndoeresume.pdf samplejohndoeresume.md

Styling is a bit harder.

I suggest the pandoc FAQ and the TeX - LaTeX Stack Exchange

John Doe Resume

While learning pandoc and playing with styling I generated a bunch of PDF samples.

The samples directories contain samples generated from samplejohndoeresume.md.

My testing indicates that the fonts are embedded in generated PDFs so they should be viewable properly across other systems.

The following commands were run on my Ubuntu Linux 14.04 LTS workstation after installing the texlive and texlive-fonts-extra packages.

There are subtle variations between the options, templates, and fonts that are usable by the various latex engines from pandoc. I am recording the following recipes since it took me a while to build up these command lines. For both engines I specify a 1-inch margin.

xelatex engine

xelatex seems to like "system fonts" such as TrueType (.ttf) or OpenType (.otf). The TeX Gyre fonts also worked.

The following commands generate a list of the "friendly names" known by the system font manager. Using the font name rather than an individual font filename seems to work better (a "font" with bold and italic styles is frequently split into multiple separate font files in the filesystem). I could not get fc-list to output only the font name, so the "cut" trims off the comma and everything after:

$ fc-list : family | cut -f1 -d"," | sort
Accanthis ADF Std
Accanthis ADF Std No2
Accanthis ADF Std No3
Andale Mono
Arial
Arial Black
Asana Math
Bitstream Charter
Cabin
Century Schoolbook L
<snip>

Alternative fc-list commands are in fc-list-examples.md.

The full list of fonts available (from my system) is in samples_xelatex/list_of_xelatex_usable_fonts.txt

The following command generates a PDF with the specified font using the xelatex engine:

$ # single incantation
$ pandoc --latex-engine=xelatex -V geometry=margin=1in -V mainfont="DejaVu Sans" -o samplejohndoeresume.pdf samplejohndoeresume.md

The following command generates PDF samples with pandoc from a list of fonts and using the xelatex engine:

$ # run on a list of fonts.
$ cd samples_xelatex
$ xargs -t -a list_of_xelatex_usable_fonts.txt -I myfont pandoc --latex-engine=xelatex -V geometry=margin=1in -V mainfont="myfont" -o myfont\ samplejohndoeresume.pdf ../samplejohndoeresume.md
pandoc --latex-engine=xelatex -V geometry=margin=1in -V mainfont=Accanthis ADF Std -o Accanthis ADF Std samplejohndoeresume.pdf ../samplejohndoeresume.md 
pandoc --latex-engine=xelatex -V geometry=margin=1in -V mainfont=Accanthis ADF Std No2 -o Accanthis ADF Std No2 samplejohndoeresume.pdf ../samplejohndoeresume.md 
pandoc --latex-engine=xelatex -V geometry=margin=1in -V mainfont=Accanthis ADF Std No3 -o Accanthis ADF Std No3 samplejohndoeresume.pdf ../samplejohndoeresume.md 
pandoc --latex-engine=xelatex -V geometry=margin=1in -V mainfont=Andale Mono -o Andale Mono samplejohndoeresume.pdf ../samplejohndoeresume.md 
pandoc --latex-engine=xelatex -V geometry=margin=1in -V mainfont=Arial  -o Arial  samplejohndoeresume.pdf ../samplejohndoeresume.md
<snip>

xelatex fontspec error (Solution: Use system fonts, not latex fonts.):

$ pandoc --latex-engine=xelatex -V geometry=margin=1in -V mainfont=electrum -o electrumsample_johndoeresume.pdf samplejohndoeresume.md
pandoc: Error producing PDF from TeX source.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
! 
! The font "electrum" cannot be found.

pdflatex engine

pdflatex seems to like latex fonts rather than system fonts. Some latex fonts include bookman, libertine, and lmodern. The font files are expected to have an .sty extension and are specified by using the filename without the .sty on the end. The problem is that .sty files do not seem to be exclusively font files, so searching for all .sty files on your system will find a lot of non-fonts.

The full list (from my system) is in samples_pdflatex/list_of_pdflatex_usable_fonts.txt which I generated by finding all .sty files and removing out the ones that did not work when supplied as a fontfamily.

Note that I could not get the font (fontfamily) to be applied unless I specified a template file also. The default.latex template installed on my system (with Ubuntu-packaged pandoc) did not seem to work so I used the latest default.latex from https://github.com/jgm/pandoc-templates and put it in the same directory as the source markdown file.

$ wget https://github.com/jgm/pandoc-templates/raw/master/default.latex

The following command generates a PDF with the specified font using the pdflatex engine:

$ # single incantation
$ pandoc --latex-engine=pdflatex --template=default.latex -V geometry=margin=1in -V fontfamily=electrum -o samplejohndoeresume.pdf samplejohndoeresume.md

The following command generates PDF samples with pandoc from a list of fonts that I found to work and using the pdflatex engine:

$ # run on a list of fonts.
$ cd samples_pdflatex
$ xargs -t -a list_of_pdflatex_usable_fonts.txt -I myfont pandoc --latex-engine=pdflatex --template=../default.latex -V geometry=margin=1in -V fontfamily=myfont -o myfont_samplejohndoeresume.pdf ../samplejohndoeresume.md
pandoc --latex-engine=pdflatex --template=../default.latex -V geometry=margin=1in -V fontfamily=allauncl -o allauncl_samplejohndoeresume.pdf ../samplejohndoeresume.md 
pandoc --latex-engine=pdflatex --template=../default.latex -V geometry=margin=1in -V fontfamily=allcmin -o allcmin_samplejohndoeresume.pdf ../samplejohndoeresume.md 
pandoc --latex-engine=pdflatex --template=../default.latex -V geometry=margin=1in -V fontfamily=allsqrc -o allsqrc_samplejohndoeresume.pdf ../samplejohndoeresume.md 
<snip>

pdflatex scalable fonts error (Solution: I used a different font. I did find hints online that this is solvable though.)

pandoc: Error producing PDF from TeX source.
! pdfTeX error (font expansion): auto expansion is only possible with scalable 
fonts.