6

I'm new to LaTeX, like really really new.

From what I've read, the default font encoding of LaTeX is OT1. Now, if I'm not mistaken, in order to change the default encoding to Type 1, I have to put \usepackage[T1]{fontenc} in the preamble. However, what will happen if I put \renewcommand{\encodingdefault}{T1} instead, or both?

  • 1
    Welcome to TeX.SX! Nothing different with T1, actually, because the encoding is known in advance. Other encodings such as T5 must be loaded with fontenc. – egreg Apr 16 '15 at 11:03
4

When you do

\usepackage[<ENCODING>]{fontenc}

the file <encoding>enc.def is loaded (the encoding name is converted to lowercase for reasons due to uniformity in the various file systems). For instance

\usepackage[T1]{fontenc}

will load t1enc.def. The start of this file is

\ProvidesFile{t1enc.def}
 [2005/09/27 v1.99g
         Standard LaTeX file]
\DeclareFontEncoding{T1}{}{}
\DeclareTextAccent{\`}{T1}{0}
\DeclareTextAccent{\'}{T1}{1}
...

and \ProvidesFile ensures the file is never loaded twice. On the other hand, fontenc.sty is basically a wrapper around \input{<encoding>enc.def}. It also defines some addition to the lowercase and uppercase settings when the requested encoding is in the list of Cyrillic encoding.

At format creation, the following encodings are also loaded

OT1  T1  OML OMS

(the last two are for math). This is the reason why just doing

\renewcommand{\encodingdefault}{T1}

works: the encoding is already known and t1enc.def has been loaded in memory.

For any other encoding, the \renewcommand you propose will issue

! LaTeX Error: Encoding scheme `<ENCODING>' unknown.

because the first duty of <encoding>enc.def is to say

\DeclareFontEncoding{<ENCODING>}{<code>}{<code>}

where the arguments specify code to execute as soon as the encoding is activated (for text and math modes respectively).

So the complete answer is:

the method with \renewcommand only works for OT1 and T1; don't use it.

Note also that the last encoding loaded with fontenc will become the default encoding for the document. More precisely, when

\usepackage[<ENCODING-1>,...,<ENCODING-n>]{fontenc}

is processed, LaTeX will do

\renewcommand{\encodingdefault}{<ENCODING-n>}

(actually executing \let\encodingdefault\CurrentOption).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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