3

Here is my code:

% foo.tex
\documentclass{article}
\usepackage{fontawesome}
\begin{document}
\faAdjust
\end{document}

I have installed basictex on Mac, so compiling the above document would fail with this expected error:

$ pdflatex foo.tex
...
! LaTeX Error: File `fontawesome.sty' not found.
...

Now I am trying to setup my own personal user-tree at an arbitrary location and compile this document. Here is what I tried.

rm -rf texmf texmf-var ~/Library/texlive # Cleanup remnants of previous trials
TEXMFHOME=texmf tlmgr init-usertree
TEXMFHOME=texmf tlmgr --usermode install fontawesome

This installs fontawesome into texmf directory but it also tries to execute updmap which fails with this error:

$ TEXMFHOME=texmf tlmgr --usermode install fontawesome
tlmgr: package repository http://ctan.mirror.ac.za/systems/texlive/tlnet (not verified: gpg unavailable)
[1/1, ??:??/??:??] install: fontawesome [270k]
running mktexlsr ...
done running mktexlsr.
running updmap ...

tlmgr: updmap failed (status 1), output:
updmap [ERROR]: Either -sys or -user mode is required.
updmap [ERROR]: In nearly all cases you should use updmap -sys.
updmap [ERROR]: For special cases see http://tug.org/texlive/scripts-sys-user.html

tlmgr: package log updated: texmf/web2c/tlmgr.log
tlmgr: An error has occurred. See above messages. Exiting.

So I now ran updmap manually.

TEXMFVAR=texmf-var updmap-user

This successfully generates the map files in texmf-var directory. At this stage this is how the texmf and texmf-var folders look like:

$ find texmf -type f
texmf/tex/latex/fontawesome/ufontawesomethree.fd
texmf/tex/latex/fontawesome/ufontawesometwo.fd
texmf/tex/latex/fontawesome/ufontawesomeone.fd
texmf/tex/latex/fontawesome/fontawesomesymbols-generic.tex
texmf/tex/latex/fontawesome/fontawesome.sty
texmf/tex/latex/fontawesome/fontawesomesymbols-pdftex.tex
texmf/tex/latex/fontawesome/fontawesomesymbols-xeluatex.tex
texmf/web2c/tlmgr.log
texmf/web2c/updmap.cfg
texmf/fonts/tfm/public/fontawesome/FontAwesome--fontawesomeone.tfm
texmf/fonts/tfm/public/fontawesome/FontAwesome--fontawesomethree.tfm
texmf/fonts/tfm/public/fontawesome/FontAwesome--fontawesometwo.tfm
texmf/fonts/opentype/public/fontawesome/FontAwesome.otf
texmf/fonts/type1/public/fontawesome/FontAwesome.pfb
texmf/fonts/enc/dvips/fontawesome/fontawesomeone.enc
texmf/fonts/enc/dvips/fontawesome/fontawesomethree.enc
texmf/fonts/enc/dvips/fontawesome/fontawesometwo.enc
texmf/fonts/map/dvips/fontawesome/fontawesome.map
texmf/tlpkg/tlpobj/fontawesome.tlpobj
texmf/tlpkg/texlive.tlpdb

$ find texmf-var -type f
texmf-var/web2c/updmap.log
texmf-var/fonts/map/pdftex/updmap/pdftex_dl14.map
texmf-var/fonts/map/pdftex/updmap/pdftex_ndl14.map
texmf-var/fonts/map/dvipdfmx/updmap/kanjix.map
texmf-var/fonts/map/dvips/updmap/ps2pk.map
texmf-var/fonts/map/dvips/updmap/download35.map
texmf-var/fonts/map/dvips/updmap/psfonts_t1.map
texmf-var/fonts/map/dvips/updmap/psfonts_pk.map
texmf-var/fonts/map/dvips/updmap/builtin35.map

Now I try to compile my pdflatex again but it fails:

$ TEXMFHOME=texmf TEXMFVAR=texmf-var pdflatex foo.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./foo.tex
LaTeX2e <2018-04-01> patch level 2
Babel <3.18> and hyphenation patterns for 22 language(s) loaded.
(/usr/local/texlive/2018basic/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2018basic/texmf-dist/tex/latex/base/size10.clo))
(texmf/tex/latex/fontawesome/fontawesome.sty
(/usr/local/texlive/2018basic/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2018basic/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(texmf/tex/latex/fontawesome/fontawesomesymbols-generic.tex)
(texmf/tex/latex/fontawesome/fontawesomesymbols-pdftex.tex)) (./foo.aux)
(texmf/tex/latex/fontawesome/ufontawesomeone.fd) [1{texmf-var/fonts/map/pdftex/u
pdmap/pdftex.map}] (./foo.aux)
kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 FontAwesome--fontawesomeone
mktexpk: don't know how to create bitmap font for FontAwesome--fontawesomeone.
mktexpk: perhaps FontAwesome--fontawesomeone is missing from the map file.
kpathsea: Appending font creation commands to missfont.log.
 )
!pdfTeX error: pdflatex (file FontAwesome--fontawesomeone): Font FontAwesome--f
ontawesomeone at 600 not found
 ==> Fatal error occurred, no output PDF file produced!

How can I compile this file with custom TEXMFHOME and TEXMFVAR paths?

Susam Pal
  • 1,281
  • 1
  • 11
  • 16
Lone Learner
  • 3,226
  • 24
  • 44
  • 1
    Why on earth aren't you installing texlive-full to avoid that hassle? – Keks Dose Sep 04 '18 at 14:57
  • 1
    @KeksDose I have texlive-full too on a different system where everything works fine. In fact texlive-full is not necessary to resolve this. Merely installing the package with --usermode but without custom TEXMFHOME and TEXMFVAR or installing it without --usermode option is sufficient to resolve this. It is only when I use --usemode, custom TEXMFHOME, and custom TEXMFVAR together that I have this issue and I want to understand the cause of this issue. – Lone Learner Sep 04 '18 at 15:13

1 Answers1

5

Short Answer

The command TEXMFVAR=texmf-var updmap-user should be TEXMFHOME=texmf TEXMFVAR=texmf-var updmap-user instead. The TEXMFHOME path needs to be specified so that updmap-user reads the font map config from the user directory, finds an entry for fontawesome in it and includes details about it in the map files generated at the TEXMFVAR path.

See point 5 in the detailed answer below for more details about this.

Detailed Answer

I am writing this detailed answer for the sake of completeness, so that anyone who wishes to set up a user tree to install fonts can just follow these instructions step by step.

Caution: Note that I recursively forcibly remove the texmf and texmf-var directories below in step 2, so that I can start a clean user environment and clearly show the files that get installed in the usertree directories. However, you might want to skip step 2 if you do not want to lose your existing usertree directories.

  1. Here is the source code file:

    % foo.tex
    \documentclass{article}
    \usepackage{fontawesome}
    \begin{document}
    \faAdjust
    \end{document}
    
  2. Start with a clean user environment:

    rm -rf texmf texmf-var
    

    Caution: Read the note above this list.

  3. Create the user tree:

    TEXMFHOME=texmf tlmgr init-usertree
    

    At this point, the user tree looks like this:

    $ tree -F texmf/
    texmf/
    ├── tlpkg/
    │   ├── texlive.tlpdb
    │   └── tlpobj/
    └── web2c/
    

    3 directories, 1 file

  4. Install fontawesome into the user tree:

    TEXMFHOME=texmf tlmgr --usermode install fontawesome
    

    When this command is run, the following error occurs:

    tlmgr: updmap failed (status 1), output:
    updmap [ERROR]: Either -sys or -user mode is required.
    updmap [ERROR]: In nearly all cases you should use updmap -sys.
    updmap [ERROR]: For special cases see http://tug.org/texlive/scripts-sys-user.html
    

    Despite the above error, fontawesome is fetched successfully. The user tree looks like this:

    $ tree -F texmf
    texmf
    ├── fonts/
    │   ├── enc/
    │   │   └── dvips/
    │   │       └── fontawesome/
    │   │           ├── fontawesomeone.enc
    │   │           ├── fontawesomethree.enc
    │   │           └── fontawesometwo.enc
    │   ├── map/
    │   │   └── dvips/
    │   │       └── fontawesome/
    │   │           └── fontawesome.map
    │   ├── opentype/
    │   │   └── public/
    │   │       └── fontawesome/
    │   │           └── FontAwesome.otf
    │   ├── tfm/
    │   │   └── public/
    │   │       └── fontawesome/
    │   │           ├── FontAwesome--fontawesomeone.tfm
    │   │           ├── FontAwesome--fontawesomethree.tfm
    │   │           └── FontAwesome--fontawesometwo.tfm
    │   └── type1/
    │       └── public/
    │           └── fontawesome/
    │               └── FontAwesome.pfb
    ├── tex/
    │   └── latex/
    │       └── fontawesome/
    │           ├── fontawesome.sty
    │           ├── fontawesomesymbols-generic.tex
    │           ├── fontawesomesymbols-pdftex.tex
    │           ├── fontawesomesymbols-xeluatex.tex
    │           ├── ufontawesomeone.fd
    │           ├── ufontawesomethree.fd
    │           └── ufontawesometwo.fd
    ├── tlpkg/
    │   ├── texlive.tlpdb
    │   └── tlpobj/
    │       └── fontawesome.tlpobj
    └── web2c/
        ├── tlmgr.log
        └── updmap.cfg
    

    22 directories, 20 files

    The texmf/web2c/updmap.cfg contains the font map configuration:

    $ cat texmf/web2c/updmap.cfg
    # Generated by /Library/TeX/texbin/tlmgr on Sun Aug 18 14:21:53 2019
    Map fontawesome.map
    
  5. Run updmap-user:

    TEXMFHOME=texmf TEXMFVAR=texmf-var updmap-user
    

    Note that it is necessary to specify TEXMFHOME=texmf in the above command so that updmap-user reads texmf/web2c/updmap.cfg (i.e., the font map config file in the user tree). If we do not do so, then the map files generated in texmf-var would not contain details about fontawesome.

  6. Finally, run pdflatex to generate the output PDF:

    TEXMFHOME=texmf TEXMFVAR=texmf-var pdflatex foo.tex
    

    Alternatively, this also works:

    TEXMFHOME=texmf:texmf-var pdflatex foo.tex
    

    The pdflatex command needs to know about both texmf (for the fonts) and texmf-var (for the font maps), that's why we need to specify both directories in the above commands.

Summary

Here are all the commands once again for convenience:

TEXMFHOME=texmf tlmgr init-usertree
TEXMFHOME=texmf tlmgr --usermode install fontawesome
TEXMFHOME=texmf TEXMFVAR=texmf-var updmap-user
TEXMFHOME=texmf TEXMFVAR=texmf-var pdflatex foo.tex
Susam Pal
  • 1,281
  • 1
  • 11
  • 16
  • Telling people to recursively forcibly remove directories without any warning or caveats is liable to cause unhappiness. Telling people to use updmap-user is likely to further it. Really, this is the way of woe. – cfr Mar 19 '24 at 04:20
  • 1
    @cfr Good point. Thanks! I have added a warning now that explains why I remove the usertree directories in my steps and why the reader might want to avoid that. The requirement for updmap-user, however, comes from the original question. As a result, my answer also ends up using updmap-user. If there is a way to solve the problem posed in the question without using updmap-user, a new answer to this question would be very welcome. – Susam Pal Mar 19 '24 at 14:38