How to write < in LaTeX or in elsarticle template? Like (p<0.01).
When I put \ before <, LaTeX can't read and just shows ! in pdflatex
Thnx.
To use the < in text mode under pdfLaTeX, you need to run
\usepackage[T1]{fontenc}
in the preamble. The default font encoding, OT1, used by pdfLaTeX is not set up to handle < -- or, for that matter, > and | -- properly in text mode.
You need not do anything special in math mode. E.g., $1<2$ or $u|v$ both produce the expected output.
Here's a full MWE (minimum working example) that illustrates this issue. The input in both screenshots is
< > | \quad $2<3$, $4>3$, $u|v$.
In the upper screenshot, the test document was compiled without \usepackage[T1]{fontenc}; in the lower screenshot, \usepackage[T1]{fontenc} is active. Observe that the symbols <, >, and | are produced correctly in math mode whether or not the T1 font encoding is specified.
\documentclass{elsarticle}
%\usepackage[T1]{fontenc}
\begin{document}
< > | \quad $2<3$, $4>3$, $u|v$.
\end{document}
In the modern toolchain, with XeLaTeX or LuaLaTeX, you can use Unicode. Load \usepackage{fontspec} or \usepackage{unicode-math}, and this, as well as many other things, will just work.
In addition to Mico’s suggestions \textgreater and \textless also work.
(p<0.01)or$(p<0.01)$if you are outside math mode. – Apr 11 '20 at 03:36