TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I’m using pdfLaTeX, my preamble usually contains




Should these two be loaded in any particular order? What problems could arise if they’re loaded in the “wrong” order?

On a related topic, I know that fontenc should come after font packages, as described in Should the fontenc package be loaded before or after font packages?, so I’d move font packages along with inputenc – unless there’s a catch as well, which would indicate something like
1) font package(s) 2) inputenc 3) fontenc?

share|improve this question

No the order doesn't matter as inputenc contains some code to avoid "order problems".

Some background: inputenc with option utf8 doesn't set up definitions for every unicode character as everyone knows who got once the message ! Package inputenc Error: Unicode char \u8:... not set up for use with LaTeX.

Instead it loads a .dfu for each font encoding declared by fontenc (naturally only if the dfu exists) so that there exist input definitions for the chars that can be printed with this font encodings.

fontenc puts all the font encodings it has been called with or which have been loaded by default in a list \cdp@list. inputenc process this list and loads the corresponding .dfu (e.g. T1.dfu) and then redefines \DeclareFontEncoding@ so that from now on every \DeclareFontEncoding will load the .dfu directly.

share|improve this answer
In this answer, David Carlisle says that fontenc should be loaded before inputenc. Is that incorrect or has the situation changed since you wrote this? – cfr May 1 '15 at 0:24

Your Answer


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.