Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I seem to recall reading somewhere that fontenc should be loaded either before or after the packages loading fonts, but I cannot remember which. I don't see differences between loading it before and after. Was what I read incorrect, or is there a preferred package loading order and why?

share|improve this question
add comment

2 Answers

up vote 21 down vote accepted

fntguide is my standard go-to reference for these kinds of questions. Here's the entirety of what it has to say about the matter:

Warning: If you wish to use T1-encoded fonts other than the 'cmr' family then you may need to load the package (e.g. times) that selects the fonts before loading fontenc (this prevents the system from attempting to load any T1- encoded fonts from the `cmr' family).

In other words, there are no (non-pathological) dependencies in the load order that affect the final output. Compilation efficiency, however, might be less in one direction than the other. I used to load fonts then fontenc but, as I have never noticed a downside effect, solely for code tidiness, now lump it with my other encoding code before loading fonts.

share|improve this answer
    
Thanks for the link to fntguide. Are you saying that using anything other than cmr is pathological? –  TH. Sep 8 '10 at 6:17
    
No, not at all. The "non-pathological" rider was just a bit of flippancy to cover against some aberrant font package causing something in this to break. (You were trolling, weren't you :)) –  Geoffrey Jones Sep 8 '10 at 8:34
    
Not really. The warning you quoted says if one wishes to use a T1-encoded font other than cmr, then one should load fontenc after the package that loads the font. You paraphrased that as saying load order doesn't matter except in pathological cases. That contradicts the warning if fonts other than cmr are not pathological. –  TH. Sep 8 '10 at 11:34
    
@TH.: I think what Geoffrey Jones means (and the warning, see Will Robertson's comment below) is that there are no dependencies in the load order, except in the pathological case that the system attempts to load T1-encoded fonts from cmr (which it may, if you load fontenc first) and they don't exist (this non-existence is pathological, for new systems). –  ShreevatsaR Sep 15 '10 at 9:11
    
@ShreevatsaR: Ah, that makes sense. I really didn't understand. –  TH. Sep 15 '10 at 9:48
add comment

It used to be a bad idea to have

\usepackage[T1]{fontenc}

before any other font packages because it could trigger LaTeX to attempt to load T1 versions of the Computer Modern font; nowadays I believe this isn't a problem because the EC fonts are installed by default (even though you probably don't want to use them with Latin Modern now in existence).

Just to be on the safe side, however, probably best to still follow this practice of first loading your font package and only then switching the encoding.

share|improve this answer
    
What is the problem if LaTeX attempts to load T1 versions of the Computer Modern font? Won't it still eventually use the font you specify later? (Is it just compilation efficiency, or the possibility that the T1 versions may not exist and give an error message?) –  ShreevatsaR Sep 14 '10 at 14:17
    
It used to give an error message (perhaps on an old version of miktex?) but not anymore. –  Will Robertson Sep 14 '10 at 22:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.