Articles

TeX / LaTeX / XeTeX / ... sort of cheatsheet

XeTeX

Changing document's main font type (using .otf files)

These files are in the same folder as the document.tex --no need to install them in the system beforehand. Which allows for archiving the .otf files along with the .tex sources. Excellent!


\setmainfont[
ExternalLocation,
BoldFont = Helvetica-Condensed-BlkObl.otf,
ItalicFont = LinLibertine_It-4.2.6.otf,
BoldItalicFont = LinLibertine_BI-4.1.0.otf
]{GoudyBookletter1911.otf}

This is obviously an extreme example. You don't need to specify all variants of the font using different font faces, as it ends up producing some 'funny' results. But as a proof of concept, it works.

Also in theory the system should detect whether a font has variants and use them and you wouldn't need to specify the entire set of variants, like this:


\setmainfont{GoudyBookLetter1911}

but it didn't work on my system. It might be because the font I chose didn't have data for the bold/italic variants, but I ended up getting white gaps in place of the italicised and bold text.