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?

marked as duplicate by egreg symbols Oct 13 '15 at 10:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 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 8:09
  • @JLDiaz made me curious now: do you know the historical reasons for this? – Bordaigorl Oct 13 '15 at 8: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 8:55
7

Use T1-encoding:

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

enter image description here

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}
  • \ensuremath{<} would provide the better spacings -- the trailing `\` isn't needed then – user31729 Oct 13 '15 at 8:04
  • @ChristianHupfer disclaimer write for this kind of solution ;-) you should post it. – Romain Picot Oct 13 '15 at 8:06
  • Nope: I've upvoted your solution already -- otherwise you will get beyond the 2k boundary :-P – user31729 Oct 13 '15 at 8:07
  • @ChristianHupfer ok I've modified my answer then ;-) – Romain Picot Oct 13 '15 at 8:11

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