7

I am trying to use the fontawesome package, however the following "alt" does not seem to produce anything.

\documentclass{article}
\usepackage{fontawesome}
\usepackage{booktabs}
\usepackage{verbatim}
\begin{document}

\begin{tabular}{lc}
\toprule
Command & Icon \\
\midrule
\verb+\faCamera+ & \faCamera \\
\verb+\faCameraRetro+ & \faCameraRetro \\
\verb+\faTable+ & \faTable \\
\verb+\faFile+ & \faFile \\
\verb+\faFileAlt+ & \faFileAlt \\
\verb+\faPicture+ & \faPicture \\
\bottomrule
\end{tabular}

\end{document}

The \faFileAlt does not produce anything. Also I've tried using \faEnvelopeAlt and still it does not produce anything. I'm using MacTeX / LaTeX for Mac.

There must have been some recent changes to the package, but I don't know what they are for the above macros that are causing the errors.

Werner
  • 603,163
J Paul
  • 397
  • 2
  • 5
  • 11
  • Are you using the appropriate TeX engine? What does the .log say? If the log file is unclear, you could edit your question to post the portions of it that seem most likely related to the problem. – jon Sep 18 '15 at 17:51
  • It states undefined control sequence \verb+\faFileAlt+ & \faFileAlt \ \verb+\faPicture+ & \faPicture \ – J Paul Sep 18 '15 at 17:53
  • Those do not look like commands according to the documentation.... – jon Sep 18 '15 at 18:15
  • Hi is there a way to increase the size of the icon in LaTeX? I found some commands like fa-lg, fa-5x. However those don't seem to work. Not sure how to write the command to increase the icon size. Thanks for your help. – J Paul Sep 19 '15 at 10:42

2 Answers2

7

An older version of fontawesome - version 2013/05/10 v3.1.1 - would have compiled to the following (compile with XeLaTeX):

enter image description here

\documentclass{article}
%\usepackage{fontawesome}
\usepackage{booktabs}
\usepackage{verbatim}

\usepackage{fontspec}
\newfontfamily{\FA}{FontAwesome}
% generic command to display an icon by its name
\makeatletter
\newcommand*{\faicon}[1]{%
  {\FA\csname faicon@#1\endcsname}}
\makeatother

\expandafter\def\csname faicon@camera\endcsname             {\symbol{"F030}}  \def\faCamera            {{\FA\csname faicon@camera\endcsname}}
\expandafter\def\csname faicon@camera-retro\endcsname       {\symbol{"F083}}  \def\faCameraRetro       {{\FA\csname faicon@camera-retro\endcsname}}
\expandafter\def\csname faicon@table\endcsname              {\symbol{"F0CE}}  \def\faTable             {{\FA\csname faicon@table\endcsname}}
\expandafter\def\csname faicon@file\endcsname               {\symbol{"F016}}  \def\faFile              {{\FA\csname faicon@file\endcsname}}
\expandafter\def\csname faicon@file-alt\endcsname           {\symbol{"F0F6}}  \def\faFileAlt           {{\FA\csname faicon@file-alt\endcsname}}
\expandafter\def\csname faicon@picture\endcsname            {\symbol{"F03E}}  \def\faPicture           {{\FA\csname faicon@picture\endcsname}}

\begin{document}

\begin{tabular}{lc}
  \toprule
  Command & Icon \\
  \midrule
  \verb+\faCamera+ & \faCamera \\
  \verb+\faCameraRetro+ & \faCameraRetro \\
  \verb+\faTable+ & \faTable \\
  \verb+\faFile+ & \faFile \\
  \verb+\faFileAlt+ & \faFileAlt \\
  \verb+\faPicture+ & \faPicture \\
  \bottomrule
\end{tabular}

\end{document}

The new equivalence would be

enter image description here

\documentclass{article}
\usepackage{fontawesome}
\usepackage{booktabs}
\usepackage{verbatim}

\begin{document}

\begin{tabular}{lc}
  \toprule
  Command & Icon \\
  \midrule
  \verb+\faCamera+ & \faCamera \\
  \verb+\faCameraRetro+ & \faCameraRetro \\
  \verb+\faTable+ & \faTable \\
  \verb+\faFileO+ & \faFileO \\
  \verb+\faFileTextO+ & \faFileTextO \\
  \verb+\faPictureO+ & \faPictureO \\
  \bottomrule
\end{tabular}

\end{document}

\faPhoto is an alias for \faPictureO.

Werner
  • 603,163
  • Thank you so much for your help. I really appreciate it. – J Paul Sep 19 '15 at 09:34
  • Hi is there a way to increase the size of the icon in LaTeX? I found some commands like fa-lg, fa-5x. However those don't seem to work. Not sure how to write the command to increase the icon size. Thanks for your help. – J Paul Sep 19 '15 at 10:42
  • 1
    @JPaul: If you add \usepackage{graphicx} to your preamble you can use \scalebox{<num>}{\faTable} to scale \faTable by a factor of <num>. If <num> < 1 it'll shrink it, and if <num> > 1 it'll enlarge it. There is also \resizebox{<width>}{<height>}{<stuff>} where <width> and <height> are lengths (or ! for default). Is this what you're looking for? – Werner Sep 19 '15 at 12:53
4

Is that what you're after? Some names have changed since version 3:

\documentclass[x11names]{article}
\usepackage{fontawesome}
\usepackage{array, xcolor} 
\begin{document}

\begin{tabular}{>{\ttfamily}ll}
    \verb+\faFileO+ & \faFileO \\[2ex]
    At 18 pt: & \fontsize{18}{22}\faFileO\\[2ex]
    \verb+\LARGE:+ & \LARGE\color{SeaGreen3} \faFileO
\end{tabular}
\end{document} 

enter image description here

Bernard
  • 271,350
  • ...not with \faPicture. – Werner Sep 18 '15 at 20:48
  • Thank you so much for your help. I really appreciate it. – J Paul Sep 19 '15 at 09:34
  • Hi is there a way to increase the size of the icon in LaTeX? I found some commands like fa-lg, fa-5x. However those don't seem to work. Not sure how to write the command to increase the icon size. Thanks for your help. – J Paul Sep 19 '15 at 10:42
  • As the icons are open type or type 1 font files, you can use the usual font size changing commands (either the standard sizes \large, \Large, &c., or specifying numerically through the \fontsize{mysize}{\mybaselineskip}. Please see my updated answer. – Bernard Sep 19 '15 at 11:53