4

I'm trying to change the font of the template in https://pt.sharelatex.com/templates/cv-or-resume/moderncv-casual .

For that, I need to use XeLaTeX and, as I understand, set

\usepackage{fontspec}
\setmainfont{Baskerville}

\renewcommand*\namefont{\fontspec{Baskerville}\fontsize{40}{48}\selectfont}
\renewcommand*\titlefont{\fontspec{Baskerville}\fontsize{20}{24}\selectfont}
\renewcommand*\addressfont{\fontspec{Baskerville}\selectfont}
\renewcommand*\sectionfont{\fontspec{Baskerville}\fontsize{20}{24}\selectfont}

Unfortunately, when I try to compile with XeLaTeX I get

"kpathsea: Running mktexmf FontAwesome

[Some stuff here, and, finally]

Package fontspec Error: The font "FontAwesome" cannot be found. "

On the other side, when I run with LaTeX, everything goes fine.

By the way, I'm using a macOS High Sierra 10.13.6.

So, what's the problem. Do I have to install this font or something like this? If so, why LaTeX identify somehow this font? Furthermore, how can I install such font if that's the case?

An example as required in the comments

\documentclass[11pt,a4paper,sans]{moderncv}      
\moderncvstyle{casual}                            
\moderncvcolor{blue}    

\usepackage{fontspec}                           
\setmainfont{Baskerville}

\renewcommand*\namefont{\fontspec{Baskerville}\fontsize{40}{48}\selectfont}
\renewcommand*\titlefont{\fontspec{Baskerville}\fontsize{20}{24}\selectfont}
\renewcommand*\addressfont{\fontspec{Baskerville}\selectfont}
\renewcommand*\sectionfont{\fontspec{Baskerville}\fontsize{20}{24}\selectfont}


\name{John}{Doe}
\title{Resumé title}                              
\address{street and number}{postcode city}{country}

\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}

\end{document}

For some reason, it also works for LuaLaTeX also as suggested by Herbert in the comments.

Thanks in advance.

user40276
  • 279
  • it looks like that the fontawesome fonts are missing. Start TeXLive Utility enable the tab "packages" and write into the upper right search field "fontawe". Then you'll get a list what is installed or not. –  Dec 01 '18 at 08:36
  • @Herbert It's installed. I have fontawesome and fontawesome5. If you need further information, let me know. – user40276 Dec 01 '18 at 08:53
  • The file template.tex is installed in /usr/local/texlive/2018/texmf-dist/doc/latex/moderncv/examples/. Copy it into any user directory, insert your above additional setting and run it with xelatex. I have no problem here with macOS Mojave and TL2018 –  Dec 01 '18 at 09:23
  • @Herbert Same problem. Even without the additional settings, XeLaTeX doesn't work. – user40276 Dec 01 '18 at 10:05
  • Show a small complete example here. I don't want to have to download, unzip and copy a whole template only to test the issue. – Ulrike Fischer Dec 01 '18 at 10:05
  • @UlrikeFischer The one that Herbert mention above would suffice. I will copy it here anyway. – user40276 Dec 01 '18 at 10:06
  • Try to run lualatex instead of xelatex –  Dec 01 '18 at 10:08
  • The example files are much too long for such an issue. – Ulrike Fischer Dec 01 '18 at 10:15
  • @Herbert It's working with LuaLaTeX. Do you have any idea on why XeLaTeX is falling in recognising fontawesome? – user40276 Dec 01 '18 at 10:26
  • @UlrikeFischer Done. – user40276 Dec 01 '18 at 10:26
  • 1
    The font is installed in the TeXLive directory, but xelatex uses only fonts from it's own directories when they are searched by the symbolic names. lualatex in difference can use all fonts. copy the fontawesome fonts into ~/Library/Fonts/ or better set a link into ~/Library/Fonts/ which points to texlives font directory –  Dec 01 '18 at 10:48
  • 5
    Does this answer your question? FontAwesome font not found? – Franklin Yu Feb 14 '20 at 10:27

1 Answers1

2

put these links into your ~/Library/Fonts/:

texlive -> /usr/local/texlive/current/texmf-dist/fonts/opentype
texlive-local -> /usr/local/texlive/texmf-local/fonts/opentype/

Then all OpenType fonts of TeXLive are also find by XeTeX. As an alternative you can choose filenames for the fonts instead of symbolic names.

  • Thanks for your answer. I, however, don't understand what -> means nor what is a symbolic name (How do I find out the symbolic name from the filename?). – user40276 Dec 02 '18 at 16:23
  • Baskerville is a symbolic name of the font, but not the file name. Have a look with the file manger into the above directories, then you‘ll get the filename of fontawesome or look here https://ctan.org/tex-archive/fonts/fontawesome/opentype –  Dec 02 '18 at 16:31
  • So there's no general way of converting one name to the other (like some command)? Also I still don't understand what that -> means. Is what follows before -> supposed to be the name of the link? – user40276 Dec 02 '18 at 16:48
  • 1
    open a terminal and input ln -s /usr/local/texlive/current/texmf-dist/fonts/opentype ~/Library/Fonts Then the open type fonts from macTeX should be found. There is a space between ...e and ~/Library... –  Dec 02 '18 at 16:55
  • Thanks for reply, but it still not working. I've got "/usr/local/texlive/2018/texmf-dist/tex/latex/fontawesome/fontawesome.sty:46:Package font spec Error: The font "FontAwesome" cannot be found." Any ideas? – user40276 Dec 03 '18 at 09:50
  • Look into your directory ~/Library/Fonts and follow the link. Can you find the awesome font? –  Dec 03 '18 at 10:08
  • Hmm... That's weird. There's no link there and yet when I try that command again it says that the file already exists – user40276 Dec 03 '18 at 10:34