109

I'm using a custom class file.

My main file looks like this:

\documentclass[12pt,a4paper]{thesis}
\begin{document}
\frontmatter
    \pagenumbering{alph}

    \pagenumbering{roman}
    \clearpage

    \cleardoublepage
    \tableofcontents
    \clearpage
    \listoffigures
    \clearpage
    \listoftables

 \mainmatter
       \part{test}
      \input{test}
\end{document}

If I put this in my test.tex it does work:

\chapter{test}
\label{chapter:test}
test 

When it becomes more text (lets say 40x the word "test") I get the error stated in my question title.

To test it I brought my class file down to this:

\ProvidesClass{thesis}
\NeedsTeXFormat{LaTeX2e}

% Based on the memoir class
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{memoir}}
\ProcessOptions
\LoadClass{memoir}

I'm totally confused what is causing my error now.

This is the complete error:

! pdfTeX error (font expansion): auto expansion is only possible with scalable 
fonts.
\AtBegShi@Output ...ipout \box \AtBeginShipoutBox 
                                                  \fi \fi 
lockstep
  • 250,273
Elmer
  • 2,254
  • 1
    I have this error with package frutiger since Tex Live 2016, with 2015 everything works fine. – Matthias Pospiech Jun 19 '16 at 15:27
  • 1
    I'm not quite sure what the problem was but I was getting that same error trying to run the Annalen der Physik class over a newish installation of MikTeX. Related to the advice here, running initexmf --mkmaps made the problem go away. – E.P. Feb 01 '17 at 00:36
  • 3
    I think I figured out two things:
    1. Thanks to @Krebto and his answer I realised that this error can be removed by running the updmap.exe in the miktex installation directory.

    2. I think if you are asked to install a new package via a software like texmaker or texworks or if you are compiling a .tex file and during this compilation, if a new package is installed, then the miktex itself is not being updated for some reason. If you then run updmap.exe immediately after, this error message vanishes.

    – ramanunni.pm Dec 23 '17 at 22:16
  • Also note that in some cases (texlive on debian) the problem is caused by .pk files in the user ~/.texlive2016/ directory. Removing this directory with rm -rf solves the issue. – begemotv2718 Jun 13 '19 at 21:36
  • I seriously recommend reconsidering the accepted answer for this question, given the top one doesn't preserve the intent of your post and that this error seems to stem from TeX installation problems/missing files. – gktscrk Jun 13 '20 at 10:48
  • I have this problem. It is rather mystifying because my file compiles fine on my office PC, but not on my laptop. (Changing the fonts DOES resolve it on the laptop, but it seems to me that the file should compile correctly without this change. However, running updmap did not resolve it; neither did completely re-installing MiKTeX. So I am at a loss about what to do. – Lasse Rempe Mar 27 '23 at 05:19

10 Answers10

110

You have to load a scalable font like lmodern:

\usepackage[T1]{fontenc}
\usepackage{lmodern}

or install the cm-super fonts.

  • 2
    But wait, i wanna use Minion Pro. Does this mean i cant use it or? – Elmer Feb 09 '11 at 21:04
  • 1
    As far as I know there is no configuration for MinionPro –  Feb 09 '11 at 21:22
  • 1
    How do you mean no configuration? U mean i cant use MinionPro with LaTeX? – Elmer Feb 09 '11 at 21:36
  • 3
    no, for microtype. There must be a configuration file which defines what to do with the characters. –  Feb 09 '11 at 21:37
  • 4
    @Herbert, @Joseph: Microtype works fine with every (scalable) font. If no specific configuration file exists it falls back to the default configuration. The error message above means that the document is using a bitmap font. A new configuration file will not solve the problem. – Ulrike Fischer Feb 11 '11 at 14:20
  • @Ulrike: I think this is only true for very recent version of the microtype package, which the OP might not have. – Philipp Feb 11 '11 at 14:40
  • @Philipp: No. It worked this way since the beginning. Also the error message is explained in the manual. (Besides the probable case that a bitmap font is used somewhere it can also be caused by if a font isn't found at all.) – Ulrike Fischer Feb 11 '11 at 14:58
  • 12
    I don't fully understand why this answer is accepted. This sounds like the solution is to not solve the problem, right? Or am I doing something wrong, and this answer really provides a solution how to use MinionPro with microtype? 5 years ago, I successfully wrote my diploma thesis with MinionPro + microtype following these instructions, so in general it is possible, but using the more recent FontPro approach gives me the same problem as the OP. – bluenote10 Mar 14 '14 at 16:16
  • 1
    Despite I use bitstream charter, I installed cm-super fonts and it worked like a charm! No need to use lmodern in my case. – Harald Feb 24 '15 at 22:37
  • @redcrash: lmodern is the better choice! –  Feb 25 '15 at 05:59
  • 1
    If anyone is wondering how to install these fonts in Ubuntu Linux: sudo apt-get install cm-super – karsten Apr 15 '21 at 09:46
  • @bluenote10: Ī̲ don’t deem this answer really good, but for me (having TeX Live 2022/dev/Debian) it was somewhat useful. After eleven years, eh? Totally not so for the (much flattered by commenters) answer by Krebto and some others. – Incnis Mrsi Sep 02 '22 at 11:02
67

I had the same error after installing latex from scratch using texlive-full. What solved it for me was to use updmap to update the fonts (https://www.tug.org/texlive/doc/updmap.html)

  • On *nix you can run updmap
  • On Windows you can navigate to C:\Program Files\MiKTeX <version>\miktex\bin\x64 and run updmap.exe. The program may seem to hang for a while, but it's probably because it tries to update the whole font tree.

After re-compiling everything should work fine.

Krebto
  • 923
  • 17
    I personally think, this answer is more pertinent than the other answers.
    Because the other answers basically ask you to default back to lmodern, which is not useful at all, if you are trying to write a thesis/important document which necessitates the use of a particular font. And not only did this work, it works like a charm for almost all fonts in the Latex Font Catalogue which previously gave this issue.Can you explain why this is the case though?

    Thanks again..

    – ramanunni.pm Dec 23 '17 at 22:05
  • 2
    Because I don't understand the logic as to why this doesn't happen by default when you run the package manager/update settings in miktex. – ramanunni.pm Dec 23 '17 at 22:07
  • 4
    This actually solves the problem and isnt a work around – JulianWgs Mar 05 '18 at 09:54
  • 6
    I can confirm that this does not require any change in the document. It just works. – miho Jun 23 '18 at 11:12
  • 4
    I agree. This should be the correct answer. – Smarzaro Jan 10 '20 at 02:14
  • 2
    I love you, you know it right? – Jepessen Jan 28 '20 at 19:25
  • @Jepessen i know :D – Krebto Jan 29 '20 at 14:26
  • 1
    This should definitely be the accepted answer. I got the above error after a reinstall of Windows and everything else. If the fonts worked before that, there's no reason that anything in the document is wrong, it's that the prerequisites didn't load properly. The problem is not with the document, but with the MiKTeX setup. – gktscrk Jun 13 '20 at 10:47
  • 1
    I don't know what made the admin not accept this answer! This answer provides the real solution, and not to change anything in the main. Thanks a lot @Krebto :) – ultralegend5385 Nov 20 '20 at 06:06
  • @ultralegend5385 thank you :) and btw the one who accept the answer is the one who asked the question not the admins... – Krebto Dec 09 '20 at 14:33
  • 1
    @Krebto: Sorry, I meant admin to be the person who asked. Little misunderstanding of terms! – ultralegend5385 Dec 09 '20 at 16:21
  • 1
    So, who is the admin anyway? – ultralegend5385 Dec 09 '20 at 16:22
  • 1
    Note that you should always run updmap-sys. Running as updmap -usr is a trap that will cause your font maps to get more and more out of date. – Davislor Dec 14 '20 at 22:58
  • 1
    This definetely should be the correct answer, since it solves the problem without forcing the use of the default lmodern font. It is a mystery why the MikTex manager does not run updmap.exe automatically to avoid this nuisance. – maurobio Mar 09 '21 at 11:39
  • 2
    Didn't work for me – BoB Mar 12 '21 at 08:59
  • 2
    Didn't work for me. I suspect some new update broke something. – AnalysisStudent0414 May 02 '21 at 12:41
  • 1
    This does not work for me, I am running MiKTeX 4.7 with no available updates. This was on a document that was working before moving to a new computer. I added \usepackage[T1]{fontenc} and \usepackage{lmodern} to get it to work for now. – Austin Downey Mar 22 '22 at 03:12
  • Where did the original question specify that the problem occurred with MiKTeX? This is definitely a poor answer, given that it’s utterly useless for any non-Windows installation. – Incnis Mrsi Sep 02 '22 at 10:52
  • This alone didn't solve it for me, but thank you for putting me on the right track! I'd reinstalled Windows and updated my TeX and MiKTeX to find that my existing documents would no longer compile, with \usepackage{microtype} and \DisableLigatures{encoding = , family = } being the apparent offenders.

    I installed cm-super via the MiKTeX console (as admin). Then ran updmap, but unlike the other executables, updmap just flashed and closed. I went back to console and tried Tasks > Refresh file name database, and success! I was expecting to have to Refresh font map files too, but all good.

    – Katanaqui Apr 12 '23 at 19:35
29

UPDATE: Added cm-super. Please comment if that does not help in your case.

First of all (as pointed out by @Herbert), you have to load a scalable font such as lmodern or mathptmx:

\usepackage[T1]{fontenc}
\usepackage{lmodern}

This, however, did not solve the issue on my freshly installed MiKTeX system. I had to install the cm-super package and to update MiKTeX completely.

I had to do the following steps:

  1. Start "MiKTeX Package Manager (Admin)"
  2. Install the cm-super package.
  3. I would recommend to update all packages to the latest version as described at https://tex.stackexchange.com/a/108490/9075.
  4. Start "MiKTeX Settings (Admin)"
  5. Press "Refresh FNDB"
  6. Press "Update Formats"
  7. Press "OK" (to close the app)
  8. Recompile. Everything should work.

MiKTeX settings
(source: miktex.org)

See also https://docs.miktex.org/manual/configuring.html#fndbupdate

The installation hint of the cm-super package is taken from https://tex.stackexchange.com/a/310169/9075 and was also stated by @Herbert

MiKTeX does not automatically install cm-super when using microtype. This was discussed on the mailinglist on 2016-11, but no action was taken.

koppor
  • 3,252
9

Check in the log-file in which package/file microtype is loaded and comment the call. Then compile your document (now without the microtype package) with pdflatex. Then check at the end of the log-file the list of fonts and identify the bitmap font(s) (with ending .pk) causing the problem.

Ulrike Fischer
  • 327,261
  • 2
    Check in the log-file in which package/file microtype is loaded how can I notice/identify that? – Kristof Tak Nov 02 '14 at 00:23
  • I am looking at the log file right now and I do not see that information. That is, there are no .pk files. Is there a way to see all the fonts that microtype has loaded somehow? – corwin.amber Oct 14 '21 at 08:54
6

Configuration files for fonts can be found in tex/latex/microtype/ subdirectory of your TeX installation.

But wait, i have no configuration file for PSCyr font; however i can use font expansion in a way like this (stretch and shrink are way too large, for the sake of demonstration):

% in preamble:
\SetExpansion[stretch = 70, shrink = 70,] { encoding = {T2A} } { }
\DeclareMicrotypeSet{t2atext}{encoding=T2A}
\UseMicrotypeSet{t2atext}

An i have result like this:

enter image description here

It's clear, i have font expansion working here.

The point is that configuration file contains commands for character protrusion and font expansion --- like this one --- nothing special or magic.

So, you can write your own command, you can collect them in your own configuration file for your favorite font face.

Read manuals, specify your values (encoding!) and enjoy.

brownian
  • 529
  • Im reading into it now. So ehm, i should use the microtype package first. And when that doesent work ur way of making my own configuration file with commands.

    Is there some explanation somwhere (on a noob level) on how to do what you just explained?

    – Elmer Feb 11 '11 at 18:35
  • microtype's manual is great! Well, i set stretchability and shrinkability to 70/1000th of em --- for T2A-encoded font. And asked microtype to use these rules. Like that. Just try!-) You will like it. – brownian Feb 11 '11 at 19:15
  • I got it all working now. Just some text looks weird, i think cuz of Minion Pro not being able to handle it. For instance: when i type griffie it looks like this in my pdf:ifïnAe. Is this something that could be fixed using microtype? I checked the microtype manual but thats abracadabra to me. – Elmer Feb 13 '11 at 18:26
  • Well, i've never got things like that. You can, however, try to disable ligatures (the manual, section 8), i would try this \DisableLigatures[ri]{encoding = T1} (and, possibly, experiment a bit more). – brownian Feb 14 '11 at 14:22
  • @Elmer could explain how did you make it work? – Kristof Tak Nov 02 '14 at 00:22
3

I had the same error after installing latex from scratch using texlive-full. What solved it for me was to simply do

updmap

which updates the fonts (https://www.tug.org/texlive/doc/updmap.html). I found this solution here: https://github.com/xdanaux/moderncv/issues/34

Diana
  • 31
2

Not really an answer, but just a post-mortem on a tricky variation of this error to watch out for; this is a bit too long for a comment.

I had loaded Utopia as the main document font (using \usepackage[utopia]{mathdesign}) as well as \usepackage[stretch=15,shrink=15]{microtype}. Everything went swimmingly, until I typeset a single character in sans-serif (\textsf{Y}). Then I got the auto expansion is only possible ... error.

The funny part was that the error was flagged on a paragraph that was downstream of the \textsf{Y} macro, but which itself contained only regular text in Utopia. When I commented out the upstream \textsf{Y}, the error disappeared. Likewise, when I loaded the lmodern or the berasans package together with [utopia]{mathdesign}, the error was gone.

If I understand the situation correctly, Utopia comes without matching sans-serif fonts, so when pdflatex encountered the \textsf{Y}, it fell back on the default CM fonts, which are not scalable; and from that point on in the document, microtype gave up on scaling.

Morale: make sure to load scalable fonts for all font shapes that you might use anywhere in the document, not just for your main document font.

2

Just to add that on MacOS 11.6 using TexLive, this problem was also solved by adding the cm-super fonts as in the accepted answer.

❯ tlmgr install cm-super

jerlich
  • 121
1

On Ubuntu, I added texlive-fonts-extra:

sudo apt install texlive-fonts-extra

And, it worked. I didn't make any changes to the tex files.

khatchad
  • 454
0

The following command works for me. Pls try this, it helps me to fix this headache!!!

initexmf --mkmaps 

works!!!

Mensch
  • 65,388
winter
  • 21