Knowledge base dedicated to Linux and applied mathematics.
Home > Latex > FAQ > Latex - FAQ > Latex how to write text in math mode
All the versions of this article: <English> <français>
It is sometimes useful to add text in Latex formulas or equations. However, it is clear that the text in question is displayed in italics. How to put text in math and what is the way of embedding text into math mode: \textrm , \text
To write text in math mode use \textrm:
$u_2 = \textrm{Second element of the sequence } u_n$
$$u_2 = \textrm{Second element of the sequence } u_n$$
Do not forget the space before closing !!!
Without \textrm, it is not beautiful:
$u_2 = Second element of the sequence u_n$
$$u_2 = Second element of the sequence u_n$$
Do not forget in preamble to add amsmath package:
\usepackage{amsmath}
To write text in math mode use with amsmath package \text:
$u_2 = \text{Second element of the sequence } u_n$
$$u_2 = \text{Second element of the sequence } u_n$$