104

Frequently there are questions about, how to manually install a font, what very often means “Type1 font”. So I thought, we should write a general answer about the several aspects to regard.

Beside the usual approach for manual installation of packages it seems, that for fonts further steps are necessary. What are these steps? Or better:

How to manually install fonts and their associated support files in TeX distributions?

Speravir
  • 19,491
  • I know the question is how to install manually, but if you are using ubuntu/debian you can install the package texlive-fonts-extra with apt-get that comes with hundreds of fonts and there is a good chance that the font that you would like to install is in the package. check the list: https://packages.debian.org/sid/fonts/texlive-fonts-extra – Renato Prado Apr 10 '20 at 03:00

3 Answers3

100

Zeroth

Before you start make sure, that there is really no possibility for an installation with the package manager of your TeX distribution. For TeX Live see also the script getnonfreefonts (here on TeX.SX user dcmt wrote a nice answer as well) and this question and answer: Error in TeX Live – Font ... not loadable: Metric (TFM) file not found .

In wide parts already described in short in TeX Users Group: Installing TeX fonts.

Siep Kroonenberg describes a different method in Font installation the shallow way (PDF, website of Dutch TeX users group NTG; the same as TUGboat article: tb86kroonenberg-fonts.pdf.)

First

You have to install the font files into a local texmf tree.

If the font package comes in a packed file, you can in most cases safely extract with subdirectories into this local texmf tree, but you should control this before doing so by comparing with the following tree structure. For instance perhaps all needed subdirectories are packed under a needless texmf directory.
Note: Sometimes map files are twice included there. In recent TeX distributions you only need the ones, which are found as mentioned below in <local-texmf>/fonts/map/<engine-name>/..., not these in <local-texmf>/<engine-name>/... – mostly <engine-name> is dvips, but sometimes also pdftex, and rarely just another one.

If there is no subdirectory structure in the packed file, you have to create it under <local-texmf> copying the structure of the according main texmf tree (known as TDS, the TeX Directory Structure) – here an almost full structure is shown (in the main texmf tree[s] it is actually more complex), for a single font package very likely only parts are necessary:

<local-texmf>
      +--fonts
          |--afm
          |   +--<font-package-name>
          |           +--<*.afm files>
          |--enc
          |   +--<engine-name>
          |           +--<font-package-name>
          |                   +--<*.enc files>
          |--map
          |   +--<engine-name>
          |           +--<font-package-name>
          |                   +--<*.map files>
          |--ofm
          |   +--<font-package-name>
          |           +--<*.ofm files>
          |--opentype
          |     +--<font-package-name>
          |             +--<*.otf files>
          |--ovf
          |   +--<font-package-name>
          |           +--<*.ovf files>
          |--ovp
          |   +--<font-package-name>
          |           +--<*.ovp files>
          |--pfm
          |   +--<font-package-name>
          |           +--<*.pfm files>
          |--pk
          |   +--<printer-type>
          |           +--<font-package-name>
          |                   +--<font-resolution>
          |                          +--<*.pk files>
          |--sfd
          |   +--<font-package-name>
          |           +--<*.sfd files>
          |--source
          |    +--<font-package-name>
          |             +--<*.mf files>
          |--tfm
          |   +--<font-package-name>
          |           +--<*.tfm files>
          |--truetype
          |     +--<font-package-name>
          |             +--<*.ttf files>
          |--type1
          |    +--<font-package-name>
          |            +--<*.pfa/*.pfb files>
          +--vf
              +--<font-package-name>
                        +--<*.vf files>

In the main texmf fonts tree(s) instead of <font-package-name> actually in almost all directories comes an additional <font-vendor> or public in between.

Also most fonts nowadays are shipped out as packages with documentation and style files. These come in

<local-texmf>
      |--doc
      |   +--fonts
      |        +--<font-package-name>
      |                |--<document files and their *.tex sources>
      |                +--<example files>
      +tex
        |--latex
        |    +--<font-package-name>
        |             |--<*.fd files>
        |             |--<*.sty files>
        |             +--<*.tex files [no document sources and examples]>
        +--plain
             +--<font-package-name>
                      |--<*.def files>
                      +--<*.tex files [no document sources and examples]>

Be careful that fonts and tex are at the same level

<local-texmf>
     |
     +fonts
     |
     +tex

Second

After copying the files you must update the file name data base of your TeX distribution:

  • In MiKTeX (note also Difference between administrative and user mode of MiKTeX )

    1. Using the GUI: In the Start Menu go to the MiKTeX entry and open the settings – if you act as admin respectively “Settings (Admin)”, of course. The “MiKTeX Options” window will open. Go to the “General” tab and click there on “Refresh FNDB” (FNDB = File Name Data Base).

    2. Using the CLI (command prompt): Execute initexmf --update-fndb (or shorter initexmf -u, as admin add the switch --admin).

  • In TeX Live

    • Linux and MacOSX: sudo mktexlsr (or, perhaps better to remember, with alias [symlink to mktexlsr]: sudo texhash.

    • Windows: mktexlsr (or the alias: texhash)

For MetaFont files (*.mf) this is enough.

For Open-/TrueType font files (*.otf/*.ttf, the directory names are misleading here, as the file extension does not say anything about OpenType abilities) you should additionally run fc-cache (MiKTeX and TeX Live Windows) or sudo fc-cache (TeX Live Linux and MacOSX) on the command prompt, but then you are ready as well. Nothing more needed for these fonts.

But note, that as long as you do not work with a portable TeX distribution it is quite probably better to install Open- or TrueType fonts into the system wide font directory since this is anyway searched and the fonts are added to the font cache with fc-cache.

MiKTeX portable users read also External font with portable MiKTeX, Version 2.9, please.

Third

For Type1 fonts (see Wikipedia, PostScript fonts) further steps are required:

  • In MiKTeX (for MiKTeX portable read also External font with portable MiKTeX, Version 2.9!)

    1. On command prompt (here no GUI possible) execute initexmf --edit-config-file=updmap.cfg (or initexmf --edit-config-file updmap). This will open your default text editor with the file updmap.cfg in your user profile under %AppData%\MiKTeX\<version>\miktex\config\. If it did not exist yet, it will be created.

      If you add the switch --admin, the file will be created/opened in %AllUsersProfile%\MiKTeX\<version>\miktex\config\ (since Windows Vista) or %AllUsersProfile%\<Application Data>\MiKTeX\<version>\miktex\config\ (until Windows XP, the string <Application Data> is language dependent) and will be valid for all users without an own file name data base.

    2. Add there at least the following (line with # is a comment, we assume here, the Map file has the name fontname.map).

      # <font name> or <package name> or what fits better for you
      Map fontname.map
      

      Save and exit. If there is more to do, this should to be read in a readme file. For information you could also open the online help page updmap.cfg or the updmap.cfg in your main MiKTeX\miktex\config installation tree and read the comments in it (but do not edit, as every edit will be lost on a later update!).

    3. Execute initexmf -u, this updates the font name data base only for the active user (you can leave this out, if you are sure, your local updmap.cfg already existed).

    4. Execute initexmf --mkmaps (or shorter updmap).

  • In TeX Live (assuming the according map file name is fontname.map)

    1. In Linux and MacOSX execute sudo updmap-sys --enable Map=fontname.map, in Windows updmap-sys --enable Map=fontname.map.

    2. Make again an update of the file name data base, see second step above.

    If you still have problems, you could try the approach given in this answer: Problems installing MathTime Professional 2 font on TexLive.

Speravir
  • 19,491
  • Note that pdftex can use truetype fonts natively, too. Some font packages require the same sort of handling as for type1 fonts except that the map file is not usually added using updmap-sys but specified in the .sty file so that step can be (and should be) omitted. (gtamac... packages are of this kind.) If metafont files are included in the package, you should use MixedMap. You don't need to update the filename databse a second time. mktexlsr $(kpsewhich --var-value TEXMFLOCAL) is quicker if you've installed into TEXMFLOCAL. – cfr Mar 11 '14 at 01:57
  • 1
    Also, you may wish to clarify that this will not work for arbitrary type1 fonts - it assumes the support files already exist. In the opentype/truetype case, fc-cache will do nothing on many Linux systems (not sure about OS X) because the font directories in texlive will not typically be specified by default as directories for fontconfig. – cfr Mar 11 '14 at 02:00
  • @cfr: I have no clue about Linux and OS X, everything above regarding this is searched from other questions/answers or asked in chat. Feel free to add your remarks into the answer – or we let your comments stay as such. Or, other idea, add a second answer, you have doubtless a lot of insight (I will delete this comment later). – Speravir Mar 11 '14 at 02:17
  • I will come back to this when I've thought about it a bit... – cfr Mar 11 '14 at 02:51
  • 2
    In the "Third step", for TexLive there is a command line sudo updmap-sys --enable Map=fontname.map. Do I have to use the name of the folder where I put my files in place of the fontname.map?? – 71GA Sep 03 '15 at 22:16
  • 2
    @71GA No. You need to use the name of the .map file which you installed into the appropriate .map file directory. Not the directory name - the file name for the .map. – cfr Sep 28 '15 at 22:33
  • 1
    The --enable stuff is no longer the recommended method for TL. I think it is now second choice as a method, at least, since it has some disadvantages. Creating (if necessary) and/or editing the relevant .cfg is preferable. – cfr Sep 28 '15 at 22:35
  • general info about how (La)TeX processes font files: http://tex.stackexchange.com/a/119488/8666 – 0 _ Jan 15 '16 at 05:33
  • 16
    This is one of the reasons people avoid tex like the plague. All this, just for a font? Seriously? Ridiculous. – Brandon Bertelsen Oct 09 '16 at 04:11
  • 9
    @BrandonBertelsen Most people never, ever need do this. I seriously doubt this is why most people avoid TeX. Most people don't avoid TeX. They've never heard of it. – cfr Jan 29 '17 at 04:24
  • 5
    I should rephrase. This is THE reason I (now) avoid tex like the plague. – Brandon Bertelsen Jan 29 '17 at 17:36
  • For the miktex portable version fc-cache is not being found. In the bin folder there is miktex-fc-cache which did the trick. – Matthias Arras Jan 13 '19 at 20:28
  • The font being provided by a GitHub repo I'm wanting to use isn't being loaded properly, and I've done what I've interpreted what was written above, but the BebasNeue font still isn't being installed, or found. I've put the contents of the package's font/ directory into my C:\texlive\texmf-local\fonts\bebas_neue directory, ran mktexlsr and updmap-sys and still no luck at finding the font. updmap tells me that I need to run mktexlsr again, but it still doesn't work. – FilBot3 Sep 30 '19 at 00:08
  • Additionally to the solution above, I had to run sudo updmap-sys after running the command with the option --enable. Not sure if this would work if I leave out the command with the --enable as mentioned by @cfr. – diophantus7 Mar 27 '20 at 11:58
  • 1
    @MatthiasArras Since about two months 'fc-cache.exe' will usually be created as alias on first package update with fonts. In user mode you may in some cases be forced to create the alias by hand, though. Cf. MiKTeX GitHub: Create "fc-cache.exe" as alias · Issue #438. – Speravir Apr 14 '20 at 17:32
  • After all these steps, if I run sudo updmap-sys alone, I still get an error saying fontname.map (in /etc/texmf/web2c/updmap.cfg) couldn't be found. How can I determine the name to use instead of fontname.map? I'm using texlive. – Yan King Yin Nov 17 '22 at 08:05
  • Despite the error message in the previous comment, my TexStudio is able to find the fonts now. Thanks. – Yan King Yin Nov 17 '22 at 08:22
3

Because other questions are linked (unfortunately) to this question I want to mention that still, this automatic installation might help others:

sudo apt-get install texlive-full

More packages will be installed and that might solve your problem. It worked for me on Ubuntu 20.04.

0

In Windows 10, manual font (*.ttf) installation in tex-live, please follow the steps,

  1. Create a directory with a font name (e.g.,) in the following path,

*C:\texlive\2024\texmf-dist\fonts\truetype\public*

  1. Copy *.ttf fonts in the newly created directory,

C:\texlive\2024\texmf-dist\fonts\truetype\public\jameel

  1. After copying the files you must update the file name database of your TeX distribution:

C:\mktexlsr (or the alias: texhash)

Now *.ttf fonts are ready to use in tex-live environment

Sharaf
  • 1
  • 1