I have a > symbol in my LateX file. Specifically, I have the sentence:

Say I have n > 1 apples.

When compile my .tex document using pdflatex, I get a pdf with an upside-down question mark in place of the > symbol.

I checked this math guide for TeX and saw no special markup for >. http://mirrors.ctan.org/info/short-math-guide/short-math-guide.pdf

What is going on?

  • 5
    That's an equation, so you should be using math mode by enclosing the text in $...$: Say I have $n > 1$ apples. – Jake Jan 25 '12 at 0:04
  • Thanks, how did pdflatex detect that I was in math mode? – David Faux Jan 25 '12 at 0:05
  • For instance, I could have very well been writing a paragraph that happened to contain n > 1, right? – David Faux Jan 25 '12 at 0:07
  • 4
    TeX doesn’t detect maths automatically. The author requests mathmode by writing \( math \) or \[ math \] when using LaTeX and $ math $ or $$ math $$ when using plain TeX. – uli Jan 25 '12 at 0:12
  • 1
    @uli Actually PDFTeX will try and guess when you are in math mode, but it is really bad at it an will screw up when it does. As someone who forgets ( too often I've seen that error a few times >.> – Canageek Jan 25 '12 at 0:13

Related question: Less than symbol (<) appears as upside down “!”

Short answers:

  • Use the fontenc package.
  • Use math mode.
  • Use the fontspec package.
  • Use \textgreater. On older installations, you might need to load the textcomp package to enable it, but this is not necessary on recent versions.

This specific example should really be in math mode, since n is a variable. But for completeness:

% comment out to see inverted question mark in place of > in ``Regular'' entry.
\item Say I have n > 1 apples (regular, with or without fontenc package).
\item Say I have \( n > 1 \) apples (math mode).
\item Say I have n \textgreater{} 1 apples (textcomp).

enter image description here

Also, the math mode greater-than sign is a bit heavier than the text symbols.

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