# What is the reason behind why > and < don't display properly without T1 font encoding?

I've read a number of posts that ask about why the symbols > and < show up incorrectly as ¡ and ¿. The solution is to use the T1 font encoding. Okay.

I'd like to learn about why these symbols show up the way they do with the original OT1 font encoding. It seems the technical reason is that the ASCII value of < was used to represent ¡ and the value for > was used to represent ¿. But, what is the historical reason for this?

Also, I know, for example, that the original OT1 font encoding (section A.1) does not include these two symbols. Okay. But then why do \textless and \textgreater generate the right glyphs and where do these glyphs come from? There are other characters, such as the blackslash () and the pipe (|). I suspect similar reasons for these?

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
– cfr
Jan 9 '15 at 21:57
• @AndrewCashner "Only 256 slots" is optimistic view on it as only 127 are used, teh classic tex fonts have no glyphs in the 8 bit range Jan 9 '15 at 22:10
• the original (OT1) fonts only have 128 slots available; since < and > are plainly needed in maths, knuth put them in the corresponding places in the maths font encodings, leaving space in the OT1 encodings for other things he reckoned he needed. T1 fonts have 256 slots available, and are therefore able to represent "<" and ">" in the font slots one might expect to find them, without these elaborate meldings of different fonts. all this mess is more-or-less covered with T1 fonts, but we're left with a default font that reflects the situation when tex was first released in the 1980s. Jan 9 '15 at 22:16
• Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. Jan 14 '15 at 17:55

Computers don't deal in symbols, they deal in numbers and < means character 60 in the current font and in the OT1 encoding that is an inverted exclamation mark. In a T1 encoded font and any other font encoding based on ASCII or Unicode that slot is a less than sign.

The default TeX fonts are designed for a different era and are 7-bit fonts (or at least 8 bit with all the top slots empty, so, on the assumption that < should be in math anyway so not needed in the text font, some slots were used to squeeze in additional symbols.

\textless and friends are defined to pull characters from the math fonts if OT1 is the current encoding.

The historical reason is that TeX was initially developed in the late seventies of the 20th century, when seven bit was the norm (the eighth bit in a byte was used for parity check).

The fonts developed by Knuth use just seven bit, so they can accommodate only 128 glyphs. In order to make available as many useful character as possible, Knuth had to discard some of those that rarely appear in normal text.

The first 32 slots were free for various symbols, but uppercase Greek, accents and f-ligatures already fill up 23 of them. Then the dotless i and j and the letters ß Æ æ Œ œ Ø ø make for 32.

Important text symbols such as the open double quotes, en-dash an em-dash, as well as ¡ and ¿ aren't in ASCII, but are used in text.

Conversely, braces {}, less than and greater than <> are much less common in text.

Just a trade-off. Note that there wasn't Unicode at that time and so a ligaturing mechanism was introduced for typesetting !¿–—.

When TeX started to spread also in Europe, the problems due to missing hyphenation point when words with accented letters were used pushed the development of a new font encoding and T1 was born, where the range of printable ASCII character (32–126) contains the ASCII characters proper.

In my opinion the presence of the uppercase Greek letters in the original font encoding is an error. But one of the aims of Knuth was not to leave any slot unfilled, in order to avoid proliferation of different ways to fill them.

These 2 lines are included in latex.ltx:

\DeclareTextSymbolDefault{\textless}{OML}
\DeclareTextSymbolDefault{\textgreater}{OML}


What this does is define these two commands so that they use the currently active font in the OML encoding, which is primarily used for mathematics. Hence, they do not rely on the OT1 encoded fonts at all.

When you use the T1 encoding, these defaults are overridden:

\DeclareTextSymbol{\textgreater}{T1}{\>}
\DeclareTextSymbol{\textless}{T1}{\<}


which ensures that the commands use the currently active font in the T1 encoding. Hence, if you use different fonts for mathematics and text for some reason, these commands will behave as expected with T1 but not with OT1 because, in the latter case, the mathematical font will be used even in text mode (because the symbols aren't otherwise available at all).

Similarly, the default definitions for \textbackslash and \textbar use OMS, another mathematical encoding, and, again, if you load T1, these are overridden to use the T1 encoded font.

All of this was necessary because originally, TeX could only use font encodings with 128 slots. T1 has 256, a number which only became possible later in TeX's development.

Note that one reason for substituting these characters in OT1 rather than, say, putting ¡ and ¿ in an alternative encoding instead is the dependence on ligatures described in egreg's answer. TeX can only use ligatures within a single font encoding. So if, say ¿ had not been in OT1, it would have been impossible to make

?


produce ¿, for example, without also putting ? and  in the other encoding. Because kerning information can only be used for character pairs within a single encoding, that, in turn, would have made it impossible to have appropriate kerning for characters preceding or following these symbols.

I can't speak as to the historical motivation. The technical reasons are clear though: the font tables for the default Computer Modern Roman font contains ¡ for < and ¿ for >. Under a different encoding, the font table has a different - "correct" - symbol. \textless and \textgreater where meant as local switches to a more appropriate font before setting. Here's an example showing the font tables for cmr10 (the typical default), the T1 font encoding of the default, and the OML font encoding of the default.

Look at the font tables for the following minimal example:

\documentclass{article}
%\usepackage[T1]{fontenc}
\usepackage{fonttable}
\begin{document}

Just some <regular text> and \textless more text\textgreater.

\show\textless
\show\textgreater

\clearpage
\fonttable{cmr10}

\clearpage
\xfonttable{T1}{cmr}{m}{n}

\clearpage
\xfonttable{OML}{cmr}{m}{n}

\end{document}


Regular:

T1:

OML:

Specifically look at positions 60 and 62.