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

Is there a way to temporarily change the font encoding with fontenc inside a document? Something like this:

I'm writing something with OT1 encoding here.
But then I want the character X to be with T1 encoding.

I'm anticipating some "Why do you want to do this?" questions. So here's why:

With OT1 encoding, using the libertine package gives me certain nice ligatures (like the one for Th). I don't with T1 encoding (no idea why). But some characters aren't available with OT1 encoding, such as \dh, so I would like to temporarily switch to T1 encoding to be able to use such characters.

share|improve this question
You can use \fontencoding{T1}\selectfont. – Ulrike Fischer Aug 28 '13 at 17:19
up vote 8 down vote accepted


{\fontencoding{T1}\selectfont  T1 stuff ...}

full example, following comments.




That {\fontencoding{T1}\selectfont That}


The log confirms the fonts used and the OT1 ligature

....\OT1/LinuxLibertineT-TLF/m/n/10 � (ligature Th)
....\OT1/LinuxLibertineT-TLF/m/n/10 a
....\OT1/LinuxLibertineT-TLF/m/n/10 t
....\glue 2.5 plus 1.25 minus 0.833
....\T1/LinuxLibertineT-TLF/m/n/10 T
....\T1/LinuxLibertineT-TLF/m/n/10 h
....\T1/LinuxLibertineT-TLF/m/n/10 a
....\T1/LinuxLibertineT-TLF/m/n/10 t
share|improve this answer
Turns out that by adding T1 as an option in the preamble, I lose the ligature for Th, which was the only reason I used the encoding OT1 in the first place. Is there a way to activate the T1 encoding only for selected characters? – Sverre Aug 28 '13 at 17:37
@Sverre see update: it works for me. (texlive 2013) – David Carlisle Aug 28 '13 at 17:46
@Sverre: Are you sure you set T1 as the first option and OT1 after it? – Ulrike Fischer Aug 28 '13 at 17:47
I found out why that happened. The order of the encoding options in the preamble matters. Setting [T1, OT1] gives default OT1 encoding, setting [OT1, T1] gives default T1 encoding. I had the wrong order (yours was right). – Sverre Aug 28 '13 at 17:47
@UlrikeFischer Exactly :) – Sverre Aug 28 '13 at 17:48

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.