I am creating a CV in LaTeX. The below code is a MWE (example.tex):
%%% ------------------------------------------------------------
\documentclass[paper=letterpaper,fontsize=10pt]{article} % KOMA-article class
\usepackage{amsmath,amsfonts,amsthm} % Math packages
\usepackage{graphicx} % Enable pdflatex (had [pdftex])
\usepackage[svgnames]{xcolor} % Colors by their 'svgnames'
\usepackage{geometry}
% \textheight=700px % Saving trees ;-)
\usepackage{url} % Clickable URL's
\usepackage{wrapfig} % Wrap text along figures
\frenchspacing % Better looking spacings after periods
\pagestyle{empty} % No pagenumbers/headers/footers
%%%%%%%%%%%%%%%%%%%%%%% FOR ICONS %%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fontawesome}
\usepackage{fontspec} %Github, mail, etc icons
\newfontfamily{\FA}[Path = fonts/]{fontawesome-webfont}
\def\faLinux{{\FA\symbol{"F17C}}}
\def\faSE{{\FA\symbol{"F18D}}}
\def\faSkype{{\FA\symbol{"F17E}}}
\def\github{{\FA\symbol{"F092}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Custom sectioning (sectsty package)
\usepackage{sectsty} % Custom sectioning (see below)
\sectionfont{% % Change font of \section command
\usefont{OT1}{phv}{b}{n}% % bch-b-n: CharterBT-Bold font
\sectionrule{0pt}{0pt}{-5pt}{3pt}
}
%%% Macros
\newlength{\spacebox}
\settowidth{\spacebox}{8888888888} % Box to align text
\newcommand{\sepspace}{\vspace*{1em}} % Vertical space macro
\newcommand{\NewPart}[1]{\section*{\uppercase{#1}}}
\newcommand{\EdEntry}[4]{
\noindent \textbf{#1} \hfill % Study
\colorbox{Black}{%
\parbox{6em}{%
\hfill\color{White}#2}} \par % Duration
\textit{#3} \par % School
\normalsize \par}
\newcommand{\ResearchEntry}[4]{
\noindent \textbf{#1} \hfill % Study
\colorbox{Black}{%
\parbox{6em}{%
\hfill\color{White}#2}} \par % Duration
\noindent \textit{#3} \par % School
\noindent \small #4 % Description
\normalsize \par}
%%% BEGIN DOCUMENT ------------------------------------------------------------
\begin{document}
\noindent \colorbox{Black}{\parbox{4em} \hfill \color{White} \Huge \usefont{OT1}{phv}{b}{n} FIRST NAME}
\newline
\noindent \colorbox{Black}{\parbox{4em} \hfill \color{White} \Huge \usefont{OT1}{phv}{b}{n} LAST NAME}
%%%%%%%%%%%%%%%%%%%%%%% FOR ICONS %%%%%%%%%%%%%%%%%%%%%%%%%
Linux icon: \faLinux \\
StackExchange icon: \faSE \\
GitHub icon: \github \\
Skype icon: \faSkype
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Education ------------------------------------------------------------
\NewPart{Education}{}
\EdEntry{Ph.D. \hspace{1mm} Major: Major Name}{Then-Now}{\hspace{11.5mm} School Name}
\EdEntry{B.S. \hspace{4mm} Major: Major Name}{Then1-Then2}{\hspace{13.5mm} School Name}
%%% Research Experience --------------------------------------------------
\NewPart{Experience}{}
\ResearchEntry{Job Title I}{Time I}{Place I}{Here I am describing my experience}
\ResearchEntry{Job Title II}{Time II}{Place II}{I will describe my experience here}
%%% References ------------------------------------------------------------
\NewPart{References}{}
Available upon request
\end{document}
The CV can be generated using "pdflatex example.tex" as long as two blocks of lines (15-21 and 63-66) are commented out. In the example above, these blocks are surrounded by comment signs with the term "FOR ICONS".
I am trying to add a few symbols to my CV (GitHub, Skype, etc). These symbols are from the FontAwesome package. All the code related to adding these symbols is in the previously-mentioned two line blocks. Hence, these two line-blocks are causing the problem.
When I try to run "xelatex example.tex", I get an error:
(/usr/local/texlive/2014/texmf-dist/tex/latex/fontspec/fontspec.sty
! Undefined control sequence.
l.1 {\rtf
1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf210
When I look in my fontspec.sty script (located in /usr/local/texlive/2014/texmf-dist/tex/latex/fontspec/), I see that the undefined control sequence is the first line.
I should say that I created the fontspec.sty file by copy-pasting everything from this link (http://chocolatshalba.ch/files/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty) into a text file, and saving it as .sty into the directory shown above.
I have been working on this problem for several hours, and am at a loss. You may gather that I am not too familiar with how the .sty files work! Thank you for any advice; it might help me get a job!…
Best Answer
It is not really a direct answer to your question, but you can access the icons of FontAwesome directly with the package
fontawesome
you are loading. Just the macro names are partly different.Loading the font manually via fontspec and creating macros is redundant. So just remove the lines 16-21, use the right macro names and you should be fine.