Font Awesome Icons in Your Latex Document

Do you want to use a bit of color, icons, or font that’s not from the early days of computing in your LaTeX file? Well, you’ve got some work to do. Not to fear, I broke it down for you!

FontSpect First

You’re going to need to use the fontspect package for any of this to work. This package is now usually included in the latest versions of LaTeX (mine version is pdfTeX 3.1415926-2.4-1.40.13 with TeX Live 2012/Debian), but just FYI you can download it via the CTAN network.

Get FontAwesome

Download the fontawesome package from CTAN network here: https://www.ctan.org/tex-archive/fonts/fontawesome?lang=en First you’ll download the zip file, then unzip the folder and place it wherever your other LaTeX package folders are.

Get XeTeX

Download the TeX engine from the terminal with: sudo apt-get install texlive-xetex

Did you get errors?

Did you try compiling your file with XeTeX and run into a problem? Of course you did. This is LaTeX and Linux after all.

Since you’re using fontspec or fontawesome for the first time, its likely you’ll get a “not-found” error. Its something with lots of exclamation points that says:

fontspec error: “font-not-found”
The font “fontawesome” cannot be found.
See the fontspec documentation for further information.
For immediate help type H .

Troubleshooting: Set Up Your Document

1) Tell the engine where to find your fontawesome folder by including it in the header (before \begin{document}):

Path = /home/path/to/folder/fontawesome/ }

2) Then, also include in the header (before \begin{document}) this list of packages:

\usepackage[usenames, dvipsnames]{color}

Run it in the Terminal

So there’s things you can do with either local variables or global variables within Emacs. If you want to learn about this, you’ll see online there are recommendations of setting up your .tex file for the XeTex engine with a “local variable”. What that means is at the very bottom of your .tex file, below \end{document} paste the following:

%%% Local Variables:
%%% mode: LaTeX
%%% TeX-PDF-mode: t
%%% TeX-engine: xetex
%%% End:

There’s also the option of setting global variables within your .emacs file to get your .tex file to compile within Emacs using the XeTeX engine and be able to switch between XeTeX or LaTeX…whew that was a mouthful. I live and breathe by emacs, but I just didn’t have time to futz with local or global variables.

In short, running this command in the terminal automatically created a PDF: xelatex /path/to/file/resume_rrc.tex

If you encounter an error, just press “Enter” let it run through the whole thing so you can get the compiled PDF, then figure out what you need to debug.

Bonus: How do I use the LaTeX fontawsome icons of my choice?

Its a little bit different, but call fontawesome in LaTex like so: \faIconName, where the icon name is capitalized. Review this page in github gist and you will get a sense of how to call the icons you want. Note, I don’t use the symbols! Just use this page as a reference for the way the icon is called in XeTeX.

For example, I like the look of \faenvelope-o, but that doesn’t work in LaTeX. Meaning \faEnvelope-o doesn’t work in LaTeX. Its actually called \faEnvelopeAlt.

XeTeX complaining that it can’t find the stylesheet?

Its the dumbest thing, but sometimes the compiler can’t find the stylesheets inside the fontawesome folder despite pulling material from the fontawesome folder during compilation. Instead it requests the stylesheets’ exact location within said folder.

My quick and dirty solution was to copy the stylesheets it wanted (fontawesome.sty and the two generic stylesheets) into my general LaTeX folder for my CV so the compiler could find it. There’s probably a better way, but I didn’t want to mess with it anymore.

Bonus: The spacing between icons and text is too small!

1) In your header (before \begin{document}) use: \renewcommand*{\acvHeaderIconSep}{}

2) Use \space to get the extra space you need.

3) Space in the LaTeX document doesn’t matter, so you may need to use \space more often.

Example: \faGlobe\space http://rrcarter.com** \space \faLinkedin\space rebeccarcarter \space\faTwitter\space rcstat**


If you’ve got a working version that allows automatic compliation of XeTeX (or allows you to switch between either) that works with AucTeX… and you’re feeling generous by posting that bit of your .emacs file please let me know in the comments. Running the command via the terminal was pretty fast though, albeit not as fast as pdflatex… but not enough of a time difference to complain about. :)

As an aside, wow did the Octopress engine not want to publish this post due to all the LaTeX code. It really was being a princess about the code blocks; I have to apologize that’s why there is so much bold in this article.