I have been playing a lot of Elden Ring lately. After investing 200 (!) hours into it, I learned three valuable lessons:
- Life is hard. Something that seems unachievable today doesn’t mean it will be tomorrow. Explore, learn, practice, and with efforts, and perhaps a little luck, suddenly, you’ve done it.
- Life is unfair. You can choose to play aggressively, play conservatively, or even move on—just don’t be greedy.
- If your artwork or software has a Gothic theme, try use a serif typeface for the UI; it will fit really well!
Admiring the UI font of Elden Ring drove me to seek a professional-grade serif typeface with an open source license. This search led me to STIX fonts. The transitional style text font (STIX Two Text) and math font (STIX Two Math) offer Times-like typography with unique design details. One particular benefit is the “familiarity” factor, which some UX research suggests improves readability, meaning higher reading speed and precision.
Since serif fonts are often used in typesetting long documents, I created a GitHub repository, nanxstats/rmarkdown-quarto-stix2, to demonstrate how to use STIX fonts in both R Markdown and Quarto for PDF outputs via LaTeX. You can find the source document examples with rendered PDF specimen there, and here is a brief summary of how it works.
The simplest way to use STIX fonts in R Markdown is to include the LaTeX package
header-includes to write the LaTeX commands directly.
You can also change the rendering engine from
Since Quarto’s default LaTeX template uses a sans serif font (Latin Modern Sans)
for the headings, it can look a bit odd when pairing with STIX fonts.
Therefore, I used the
helvet package to match the familiarity:
There are some common issues that can be fixed or alleviated by using
additional options from the
The stix2-type1 package
documentation explains these options in detail.
Loading textcomp twice: You probably noticed that we used the
notextcompoption to avoid loading the
textcomppackage. This is because the default pandoc template already loads it.
Math font conflicts: XeLaTeX has some issues with the math font, so we used the
nomathoption to disable it when using XeLaTeX. Otherwise, there will be errors related to “command already defined”.
As a simple solution, using
nomathhas no practical impact, especially if you don’t use math in the document. However, if you do use math and try the savesym method to avoid the errors, there will still be significant issues when rendering, such as missing summation symbols in the formulas.
So far, I have not found a working solution for this issue yet, so if you know how to make it work properly, please let me know.
That’s it. If you prefer the Computer Modern typeface but want a bolder version, see the previous post about MLModern.