When typing <
or >
in LaTeX and compiling with pdflatex
, the less than and greater than symbols appear at upside down exclamation points. I'm not in math mode.
3 Answers
Geoffs tip with \textless
and \textgreater
will work well for you. However, you could type these symbols < and > directly in your editor and they would be correctly printed if you use the recommended font encoding, Cork resp. T1:
\usepackage[T1]{fontenc}
Have a look at the T1 encoding table, search for the symbols < and >. Afterwards, open the OT1 encoding table, which is the default. At the two corresponding places you will find the upside down exclamation resp. quotation mark. That should explain it.
For further reasons, why you should use T1 encoding, have a look at this question: Why should I use \usepackage[T1]{fontenc}?
You should use a font supporting T1. For instance use the very good Latin Modern font, derived from the standard fonts:
\usepackage{lmodern}
Or install the cm-super
package which provides the standard Computer Modern fonts with T1 support.
-
2
-
2
-
2@HaoSun It's an improvement. If something would change that you don't desire, it can be fixed. If you don't want any change, just don't change.– Stefan Kottwitz ♦Jun 13, 2016 at 22:24
-
1
Use \textless
and \textgreater
.
-
12unless they are part of a math expression, in which case they should be between dollar signs or \( ... \) along with the rest of the math expression. Aug 26, 2010 at 19:51
What I usually do is just enter mathmode to type them, e.g. This object is $<$ that object
.
-
22That is generally considered poor style. You should just write out "This object is less than that object." Occasionally, you'll see "foo is <0." This looks bad.– TH.Aug 27, 2010 at 23:32
-
12That's definitely true. However, if you're using LaTeX to organize your thoughts (as i often do), 'good style' equates to 'will I understand what I wrote if I come back and look at it in a week'! Sep 3, 2010 at 3:30
-
@TH.: I agree with you. My experiency tells me too that text and math code should not be mixed up. Good style would be either writing "The variable $foo$ is less than zero." (as you mentioned) or "The variable $foo$ satisfies the relation/condition $foo<0$.", which would probably suit your application. Good style means also to define variables at the first use.– strpeterDec 7, 2013 at 8:07
-
1@strpeter While mentioning style, it is worth noting that
variable $foo$
is not good style either: it refers to the product of$f$
,$o$
, and$o$
. You meanvariable $\mathit{foo}$
.– akimDec 8, 2014 at 9:19 -
OK, I was not typing it correct in the sense of the variable as I focused on the operator. You're right - use your preferred version
$\mathit{foo}<0$
,$\mathrm{foo}<0$
,$\mathbf{foo}<0$
, or whatever variable. ;)– strpeterDec 8, 2014 at 10:40
fontspec
package. In this case, you do not want to load the T1 encoding. The encodings will already be set up properly.|
: font encodings - How to insert pipe symbol in (La)TeX? - TeX - LaTeX Stack Exchange ■ question explaining the historical reason for this oddity: What is the reason behind why > and < don't display properly without T1 font encoding? - TeX - LaTeX Stack Exchange