[Tex/LaTex] Configuring fontawesome5 on overleaf

fontawesomeoverleaf

I'm looking at this CTAN Package. I don't think it's a part of texlive 2016 which is what overleaf uses.

This means I have to upload files manually to my overleaf project so that I could include them. I downloaded the zip folder available on package, unzipped it and uploaded it to my project with exactly the same directory structure

Next I used the latexmkrc file to configure latex to search the .sty files in the uploaded folder as suggested on their documentation page

This is what my file looks like:

$ENV{'TEXINPUTS'}='./fontawesome5///:' . $ENV{'TEXINPUTS'}; 

Now my latex file compiles, but the icons like \faGithub don't render.

My usecase is that I want to use some of the new icons which are present in fontawesome5 but not in fontawesome4.

Note that when I use the package fontawesome then thing are working.

Best Answer

The line

$ENV{'TEXINPUTS'}='./fontawesome5///:' . $ENV{'TEXINPUTS'};

tells TeX where to look for the TeX files in the package, but not where to find the actual font.

To access the font with pdfTeX, TeX needs to know where to find some additional kinds of files:

  • Font metrics (.tfm files in dir tfm) The ENV variable is TFMFONTS
  • Encoding vectors (.enc files in dir enc) The ENV variable is ENCFONTS
  • The actual fonts (in Type 1 format) (.pfb files in dir type1) The ENV variable is T1FONTS
  • Font maps (.map files in dir map) The ENV variable is TEXFONTMAPS

Additionally TeX needs to know that it has to load the font map from fontawesome5.

So you need to add

\pdfmapfile{+fontawesome5.map}

in the preable of your document and write

$ENV{'TEXINPUTS'}='./fontawesome5/tex/:' . $ENV{'TEXINPUTS'};
$ENV{'TFMFONTS'}='./fontawesome5/tfm/:' . $ENV{'TFMFONTS'};
$ENV{'ENCFONTS'}='./fontawesome5/enc/:' . $ENV{'ENCFONTS'};
$ENV{'T1FONTS'}='./fontawesome5/type1/:' . $ENV{'T1FONTS'};
$ENV{'TEXFONTMAPS'}='./fontawesome5/map/:' . $ENV{'TEXFONTMAPS'};

in your latexmkrc.

Related Question