6

I am trying to compile resume.tex that uses awesome-cv class following this resume template. I get the following error:

usr/local/texlive/2016/texmf-dist/tex/latex/public/fontawesome/fontawesome.sty: 45: font spec error: "font-not-found"
The font "FontAwesome" cannot be found.
l.45 \newfontfamily{\FA}{FontAwesome}

The problem arises on line 77 of awesome-cv.cls when running this line: \RequirePackage{fontawesome}. This problem has been mentioned in this question. I tried the following lines of code in a test.tex file and was able to run it where these three options all worked: LaTeX, XeTex and LuaLaTex.

\documentclass{article}
\usepackage{fontspec}
\usepackage{fontawesome}
\begin{document}
\faTwitter
\end{document}

My confusion is that how come I can run the above lines of codes successfully, but TeXShop fails to require the same package when I run resume.tex. Adding a path (below) as suggested by one of the solutions from here didn't work either.

\defaultfontfeatures{
Path = /usr/local/texlive/2016/texmf-dist/fonts/opentype/public/fontawesome/ }

PS: I just downloaded and installed the newest distributions of mactex.

Thanks for your help

UPDATE:

Beside resume.tex, I have a class file named awesome-cv.cls and also fontawesome.sty and a fonts folder that contains files such as FontAwesome.ttf, Roboto-Bold.ttf, etc. If I run resume.tex in latexshare website using LuaLaTex, it works without any problem. By putting fontawesome.sty and fonts folder and referring to them in awesome-cv.cls, we make sure we are using the right file. Now, if I try that in my MacBook Pro, I get this error (yellowish message) where the problem happens at Line 12 of fontawesome.sty when it is called in awesome-cv.clos:

% Define shortcut to load the Font Awesome font.
\newfontfamily{\FA}{FontAwesome}

***: If I erase fontawesome.sty and fonts folder, I get a very similar error this time stating the installed location of fontawesome package:

usr/local/texlive/2016/texmf-dist/tex/latex/public/fontawesome/fontawesome.sty: 45: font spec error: "font-not-found"
The font "FontAwesome" cannot be found.
l.45 \newfontfamily{\FA}{FontAwesome}

enter image description here

ahoosh
  • 193
  • 2
  • 7
  • If you compile with xelatex you can install fontawesome as a system font. – Bernard Dec 25 '16 at 23:05
  • @Bernard Where do I install fontawesome as a system font if I run TeXShop using xelatex? I run it and it gives me the same error. – ahoosh Dec 25 '16 at 23:12
  • 2
    You install them like all others fonts for MacOS. I can't tell you more about it, as I don't use a Mac myself. But perhaps the problem is in resume.tex itself. – Bernard Dec 25 '16 at 23:16
  • @Bernard The error happens when I try to load fontawesome package specifically in \newfontfamily{\FA}{FontAwesome} inside fontawesome.sty. I am not sure it's due to a problem in resume.tex – ahoosh Dec 26 '16 at 00:42
  • 1
    Why don't you simply load the fontawesome package and use, viz. \faTwitter? – Bernard Dec 26 '16 at 00:53
  • @Bernard I am trying to figure out why loading \newfontfamily{\FA}{FontAwesome} inside fontawesome.sty raises an error when being called from awesome-cv class, but works fine if I load the package in other conditions. I guess somehow the path is not detected in that case. – ahoosh Dec 26 '16 at 04:39
  • 1
    in a normal texlive fontawesome is not in a public folder /tex/latex/public/fontawesome/. Did you copy some local version there? – Ulrike Fischer Dec 26 '16 at 12:31
  • 1
    @UlrikeFischer I didn't make any manual changes to the fonds folders. I am wondering if fontawesome is not in a public folder, why does \faTwitter example works? If that is the case. should I emphasize a PATH using something like \newfontfamily{\FA}[PATH]{FontAwesome} inside fontawesome.sty or I need to make a public folder with the fonts? – ahoosh Dec 26 '16 at 19:15
  • If I run the document in https://www.sharelatex.com/ there is no problem and the codes runs successfully using LuaLaTex – ahoosh Dec 26 '16 at 19:17
  • I didn't mean the fonts but the sty. Run the failing example with lualatex and also the one that works and show the log-files. – Ulrike Fischer Dec 26 '16 at 19:47
  • @UlrikeFischer I just added an UPDATE section and covered the error. It is strange! It is working fine in sharelatex. Also, I can load fontawesome and use it for other tasks! – ahoosh Dec 27 '16 at 17:57
  • 2
    Sigh. When I write "log-files" I mean log-files and not "some snippet that you think is relevant". I need a complete log of a working and a failing compilation to be able to compare them. – Ulrike Fischer Dec 27 '16 at 18:01
  • Please provide the log from the working example on the MacBook to compare with the non-working case on the same system. Please post log files here or on a pastebin-type site rather than dropbox, which is a PITA. I accidentally downloaded the file, but removed it. Sorry, but I don't trust .zip files from unknown sources. – cfr Dec 27 '16 at 21:08
  • 1
    @cfr Sure. The log file containing the error is here http://pastebin.com/ty15UGC0 and the one working is http://pastebin.com/WEHxBNPp, both run on MacBook Pro. – ahoosh Dec 27 '16 at 22:06
  • The successful run is with LuaTeX. What happens if you compile the minimal example document with XeTeX? – cfr Dec 27 '16 at 23:01
  • As @UlrikeFischer said, there is definitely something weird with your installation. That is not the correct path for fontawesome.sty. – cfr Dec 27 '16 at 23:04
  • Don't use the class file. If you like it, take the bits which are important and incorporate those. The class does several things it shouldn't. Moreover, it is not designed to be used out-of-the-box. You have to adapt it to your system in order to use it. It includes, for example, \newfontfamily\FA[Path=\@fontdir]{FontAwesome} which is not going to work well ... If you insist, try commenting out that line. – cfr Dec 27 '16 at 23:12
  • @cfr If I run the minimal example with XeLaTeX, I get an error similar to the error I get when running resume.tex which happens at l12 \newfontfamily{\FA}{FontAwesome} – ahoosh Dec 30 '16 at 17:58
  • @cfr When running the minimal example with LuaLaTeX, it works perfectly and the location of fontawesome is at usr/local/texlive/2016/texmf-dist/fonts/opentype/public/fontawesome/FontAwe some.otf. Doesn't that tell us that the installation is fine? – ahoosh Dec 30 '16 at 18:00
  • Regarding the line \newfontfamily\FA[Path=\@fontdir]{FontAwesome}, I agree with you. I have a fonts folder beside .tex file. The same combination works fine in sharelatex. Currently I am running it there, but I am baffled why it does not work on my laptop. – ahoosh Dec 30 '16 at 18:04
  • The engines find fonts differently. That a font is installed correctly for use with one doesn't mean it will work with the other. Perhaps look at the fontspec manual to see what it says about the use of Path with XeTeX? – cfr Dec 31 '16 at 14:37

0 Answers0