# Fancy Icons and LaTeX Quirks

Published:

I recently updated my CV to add my ORCiD identifier to it up top among the other places to find me online. An ORCiD is an online identifier that persists through any changes to your name, institution, or email address throughout your life. It’s also particularly useful if your name has to be romanized. You can think of it a bit like a DOI for a person. If you’re feeling fancy, an ORCiD is represented by the symbol. Unfortunately, this little icon is can be a big pain to get into a LaTeX document. The icon is part of the Academicons font family, which is implemented in TeX via the academicons package. While the icons come from the fontawesome package which requires no special effort, the academicons package is not so easygoing.

In order for academicons to work, you have to use the XeTeX or LuaTeX TeX engine. If you’re like me, you’ve a) never thought about which TeX engine you use and b) used pdfTeX. pdfTeX is the default for most modern TeX editors, and it works just fine for most folks. You could change your editor’s default TeX engine to LuaTeX, but this can (and probably will) have unintended consequences for all of your other TeX documents. One way around this is to go old school and use the command line lualatex cv.tex but I’m lazy and I like the convenience of being able to compile my CV from within my editor.

The workaround relies on magic comments which are special comments that function similarly to a shebang in shell scripts. Just like shebangs, they need to go at the top of your .tex file. The exact format depends on the editor you use, so check out the Stack Exchange link above. For TeXstudio, this looks like this:

% !TeX program = lualatex
\documentclass[11pt]{article}
...


The magic comment tells TeXstudio to use LuaTeX instead of pdfTeX for this document only. Now I can compile my CV with my fancy one moment, then flip to another tab containing a working paper and compile it without having to change any settings in TeXstudio itself! This is especially useful if you have to use specialized fonts (and thus can’t use pdfTeX) in just a hanful of documents but not in most.

Of course, TeX being TeX, it turns out that LuaTeX uses different names for the fonts I use with pdfLaTeX. It also uses a completely different syntax for specifying font names, so I had to spend an hour on Stack Exchange to figure out how to get the rest of my CV to look like it used to with pdfLaTeX. A less stubborn person might find a lesson in all this…

Tags: