1

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!...

7
  • 3
    You seem to have saved fontspec as rtf-file. Instead of copying the file manually install the package with the tools of your texsystem (but it shoul be in texlive 2014 anyway) Feb 7, 2016 at 22:04
  • 1
    Do not copy the .sty from the first place you happen to come across it! A normal TeX Live 2014 installation will have it, and in a newer version than the random one you found. If it does not, then there are bigger problems with your installation that need to be addressed. And never install files yourself into /usr/local/texlive/2014/texmf-dist. It may be that you overwrote the actual file your system already had. There are other places for installing your own files. (And many questions here about what to do with 'personal' .sty files.)
    – jon
    Feb 7, 2016 at 22:26
  • @jon thank you! Do you mean if I download "Tex Live 2014", it will have the .sty file I need? Is there a way for me to see if I even have Tex Live 2014? I am thinking that might be the better approach, because I cannot find the fontspec.sty file anywhere else...
    – user84756
    Feb 8, 2016 at 2:17
  • 1
    You do have TL 2014: if you look in the error line you posted, you'll see: "(/usr/local/texlive/ 2014 /texmf-dist/...". You should have fontspec installed, though it depends on how you got TeX Live in the first place, which remains unclear. However, note that, for the most part, and certainly until you know what you are doing, you should rely on your official distribution and what is available on CTAN.
    – jon
    Feb 8, 2016 at 2:51
  • 2
    MacTeX is (I think) the best choice for Macs, but I have never used it. It is, however, the Mac version of TeX Live. FYI, fontspec is available on CTAN here, but you have to know to generate the .sty from the .dtx file, or install directly the .tds.zip file (which is the easiest option). I'd advise installing MacTeX. Get the 2015 version, of course!
    – jon
    Feb 8, 2016 at 3:16

1 Answer 1

1

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.

%%%%%%%%%%%%%%%%%%%%%%% FOR ICONS %%%%%%%%%%%%%%%%%%%%%%%%%
Linux icon: \faLinux \\
StackExchange icon: \faStackExchange \\
GitHub icon: \faGithub \\
Skype icon: \faSkype
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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.

2
  • I downloaded MacTex 2015, and then followed your suggestions. I believe downloading this helped my problem (in terms of the fontspec.sty file being appropriately configured). However, I did use your changes (because it seems like a more direct way), but I get an error when I run lulatex example.tex "Undefined control sequence. l.145 \faLinux". Strangely, if I change \faLinux with \faTwitter, then I get a twitter symbol! Any idea why \faLinux would not work, while \faTwitter would? Thank you again!
    – user84756
    Feb 8, 2016 at 19:37
  • 1
    Did you also update all the packages to the latest version? Just start the program TeX Live Utility which was installed alongside MacTeX and select Actions > Update All Packages in the menubar to do so.
    – Benjamin
    Feb 8, 2016 at 19:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .