# How to add a line inside an equation

I would like to introduce a line break in text line inside an equation.

What I have done is:

\begin{align*}
\end{align*}


And what I would like to reproduce is the left side of the equal:

• Why don't you use variables and explain them in proper sentences? What I see in the picture makes me cringe. – Johannes_B Sep 13 '18 at 5:25
• I have a big lack of latex language and for this reason I cannot give you a proper answer – Another.Chemist Sep 13 '18 at 5:27

A variant, with the \Centerstack command,, which automatically starts text mode, and can take an optional argument to set the alignment of the lines:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage[usestackEOL]{stackengine}

\begin{document}

$$%% \Longstack is probably better, look at the manual for stackengine... \frac{\,\Centerstack[l]{Relative reactivity of \\ a secondary hydrogen}\,}% {\Centerstack[l]{Relative reactivity of \\ a primary hydrogen}} = \frac{\,\Centerstack[l]{yield of product from \\ secondary hydrogen abstraction}\Bigm / \Centerstack[l]{number of \\ secondary hydrogens}\,}% {\Centerstack[l]{yield of product from \\ primary hydrogen abstraction}\Bigm /\Centerstack[l]{number of \\ primary hydrogens}}%$$

\end{document}


Define a suitable command for those “textual variables”:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\tvar}[1]{%
\textup{%
\begin{tabular}{@{}l@{}}
#1
\end{tabular}%
}%
}

\begin{document}

\begin{equation*}
=
\frac{
\left(\tvar{Abc def \\ ghi klm}\right)\bigg/
\left(\tvar{Abc def \\ ghi klm}\right)
}
{
\left(\tvar{Abc def \\ ghi klm}\right)\bigg/
\left(\tvar{Abc def \\ ghi klm}\right)
}
\end{equation*}

\end{document}


You can do it, which does not mean you should do it. I agree with @Johannes_B, using proper variables will increase the readability a lot.

You can use stackengine for these things:

and still, this is IMHO better:

Full MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{stackengine}
\begin{document}
$$%% \Longstack is probably better, look at the manual for stackengine... \frac{\text{\stackunder{Relative reactivity of}{a secondary hydrogen}}}% {\text{\stackunder{Relative reactivity of}{a primary hydrogen}}} \cdots$$

\bigskip

But this is better:

Call $R_2$ the relative reactivity of a secondary hydrogen, $R_1$ the relative reactivity of a primary hydrogen, \dots
$$\frac{R_2}{R_1}\cdots$$
\end{document}