2

I'm trying to write a simple < in my text, but each time I write it, an upside-down ! is there. And for > I get an upside-down ? Can someone please help me?

moewe
  • 175,683
  • 4
    Solutions are already given. The reason behind that strange behaviour is that CMR font (which is the standard TeX font) uses an encoding which is almost ASCII, except for codes 60 and 62, which are ASCII < and >. In those codes cmr stores the glyphs for ¡ and ¿. Moreover, cmr has no glyphs for <, > so you have to resort to another font, which is what $<$ or \textgreater or \verb|<| do. – JLDiaz Oct 13 '15 at 08:09
  • @JLDiaz made me curious now: do you know the historical reasons for this? – Bordaigorl Oct 13 '15 at 08:21
  • @Bordaigorl I don't remember the source. Perhaps The TeXbook, perhaps TeX FAQ, or some tugboat, or some document about OT1 encoding... I'm a bit "historical" too :-) – JLDiaz Oct 13 '15 at 08:55

3 Answers3

7

Use T1-encoding:

\documentclass{article}
\usepackage[T1]{fontenc}
\begin{document}
 < and >
\end{document}

enter image description here

Ulrike Fischer
  • 327,261
3

The commands \textless and \textgreater are designed for this usage of < and > in text mode.

\documentclass{article}
\begin{document}
There are also \textgreater\ and \textless
\end{document}
2

Disclaimer: A solution but not the better one.

Edit: see Christian Hupfer comment.

Use inline math:

\documentclass{article}

\begin{document}
\ensuremath{<} is not < .
\end{document}

You can define a command if you want:

\documentclass{article}

\begin{document}
\newcommand{\foo}{\ensuremath{<}}
\ensuremath{<} is not < .

But \foo{} is \ensuremath{<} !
\end{document}
Romain Picot
  • 6,730
  • 4
  • 28
  • 58