# How to write a long fractional expression in an ideal way?

Consider the following MWE:

\documentclass[12pt, a4paper]{report}
\usepackage{amsfonts, graphicx, verbatim, mathtools,amssymb, amsthm, mathrsfs,amsmath}
\begin{document}
\begin{align}
S_2^* &= \frac{(\gamma_A + \sigma+\mu)(\gamma_I+\eta+\alpha+\mu)}{\beta_A(\gamma_I+\eta+\alpha+\mu)+\sigma \beta_I}\\[1ex]
A_2^* &= \frac{\gamma_I+\eta+\alpha+\mu}{\sigma}I_2^*\\[1ex]
I_2^* &= \frac{\mu  \sigma  (\gamma_A+\mu +\sigma ) (\mu +\xi +\rho ) (\alpha +\gamma_I+\eta +\mu )}{\beta_A (\alpha +\gamma_I+\eta +\mu )+\beta_I \sigma ) (\mu  (\gamma_A+\mu +\xi ) (\alpha +\gamma_I+\eta +\mu )+\alpha  \sigma  (\mu +\xi )+\mu  \sigma  (\gamma_I+\eta +\mu +\xi ))}(\mathcal{R}_0 -1)\\[1ex]
R_2^* &= \frac{\gamma_A(\gamma_I + \eta+\alpha+\nu)I_2^*+\sigma(I_2^*(\gamma_I+\eta)+b\nu+\rho S_2^*)}{\sigma(\mu+\rho)}
\end{align}
\end{document}


We see the expression for $I_2^*$ does not fit on the page so what is ideal way to fix this?

• Perhaps you can assign a variable to the numerator and denominator separately, and then write $I_2^*$ as their ratio. Commented May 25, 2022 at 14:47
• @Jinwen That would still exceed page margins, however one possibility is that I could assign say $k1= \gamma_A + \mu + \sigma$ but I will wait for potential answers.
– Math
Commented May 25, 2022 at 14:51
• You can split the long line into two, see my answer below. Commented May 25, 2022 at 14:58

You could use a matrix environment to split the very long denominator term in equation (3) across three lines.

\documentclass[12pt, a4paper]{report}
\usepackage{amsmath,amssymb} % I've simplified the preamble as much as possible
\begin{document}
\begingroup % localize scope of next instruction:
\addtolength\jot{1ex} % increase spacing beween rows
\begin{align}
S_2^* &= \frac{(\gamma_A + \sigma+\mu)(\gamma_I+\eta+\alpha+\mu)}{\beta_A(\gamma_I+\eta+\alpha+\mu)+\sigma \beta_I}\\
A_2^* &= \frac{\gamma_I+\eta+\alpha+\mu}{\sigma}I_2^*\\
I_2^* &= \frac{\mu  \sigma  (\gamma_A+\mu +\sigma) (\mu +\xi +\rho) (\alpha +\gamma_I+\eta +\mu)}{%
\left(%
\begin{matrix}
\beta_A (\alpha +\gamma_I+\eta +\mu) \hfill \\
{}+\beta_I \sigma  \bigl[\mu  (\gamma_A+\mu +\xi) (\alpha +\gamma_I+\eta +\mu)\\
\hfill {}+\alpha  \sigma  (\mu +\xi)+\mu  \sigma  (\gamma_I+\eta +\mu +\xi)\bigr]
\end{matrix}
\right)}(\mathcal{R}_0 -1)\\
R_2^* &= \frac{\gamma_A(\gamma_I + \eta+\alpha+\nu)I_2^*
+\sigma[I_2^*(\gamma_I+\eta)+b\nu+\rho S_2^*]}{\sigma(\mu+\rho)}
\end{align}
\endgroup
\end{document}


Here is a method that assigns variables to the numerator and denominator separately, and then write $I_2^*$ as their ratio.

\documentclass[12pt, a4paper]{report}
\usepackage{amsmath}
\begin{document}
\begin{align}
S_2^* &= \frac{(\gamma_A + \sigma+\mu)(\gamma_I+\eta+\alpha+\mu)}{\beta_A(\gamma_I+\eta+\alpha+\mu)+\sigma \beta_I}\\[1ex]
A_2^* &= \frac{\gamma_I+\eta+\alpha+\mu}{\sigma}I_2^*\\[1ex]
I_{2,1}^* &= \mu  \sigma  (\gamma_A+\mu +\sigma ) (\mu +\xi +\rho ) (\alpha +\gamma_I+\eta +\mu )\\
I_{2,2}^* &= \beta_A (\alpha +\gamma_I+\eta +\mu )+\beta_I \sigma (\mu  (\gamma_A+\mu +\xi ) (\alpha +\gamma_I+\eta +\mu )\nonumber\\
&\quad +\alpha  \sigma  (\mu +\xi )+\mu  \sigma  (\gamma_I+\eta +\mu +\xi )) \\
I_2^* &= \frac{I_{2,1}^*}{I_{2,2}^*}(\mathcal{R}_0 -1)\\[1ex]
R_2^* &= \frac{\gamma_A(\gamma_I + \eta+\alpha+\nu)I_2^*+\sigma(I_2^*(\gamma_I+\eta)+b\nu+\rho S_2^*)}{\sigma(\mu+\rho)}
\end{align}
\end{document}


• To get symmetric spacing around the = symbols, you should replace all inastances of =& with &=.
– Mico
Commented May 25, 2022 at 18:28
• @Mico I would like that, but then how should I place the + (line(4) here) on the right of =? Commented May 25, 2022 at 18:31
• Just change the & symbol on that line to &\quad.
– Mico
Commented May 25, 2022 at 18:54
• @Mico Thank you! Fixed :) Commented May 25, 2022 at 18:57

I would define one more auxiliary variable, let be A = \gamma_I + \eta + \alpha + \mu and write your equations as:

\documentclass[12pt, a4paper]{report}
\usepackage{mathtools, amssymb, amsthm, mathrsfs}

\begin{document}
Let be $A$ defined as
\begin{align}
A & = \gamma_I + \eta + \alpha + \mu
\shortintertext{and}
S_2^*
& = \frac{(\gamma_A + \sigma + \mu)A}{\beta_A A + \sigma \beta_I}   \\
I_2^* &= \frac{\mu \sigma (\gamma_A + \mu + \sigma )(\mu + \xi + \rho)A(\mathcal{R}_0 -1)}
{(\beta_A A + \beta_I\sigma)(\mu(\gamma_A+\mu +\xi)A + \alpha\sigma(\mu +\xi )+\mu \sigma (\gamma_I+\eta +\mu +\xi))}                  \\
\intertext{then}
A_2^*
& = \frac{A}{\sigma}I_2^*                                           \\
R_2^*
& = \frac{\gamma_A(\gamma_I + \eta+\alpha+\nu)I_2^* + \sigma(I_2^*(\gamma_I+\eta)+b\nu+\rho S_2^*)}{\sigma(\mu+\rho)}
\end{align}
\end{document}


I would use the \splitfrac command, from mathtools (which loads amsmath) this way:

    \documentclass[12pt, a4paper]{report}
\usepackage{graphicx, verbatim, mathtools,amssymb, amsthm, mathrsfs,mathtools}
\usepackage{showframe}

\begin{document}

\begin{align}
S_2^* &= \frac{(\gamma_A + \sigma+\mu)(\gamma_I+\eta+\alpha+\mu)}{\beta_A(\gamma_I+\eta+\alpha+\mu)+\sigma \beta_I}\\[1ex]
A_2^* &= \frac{\gamma_I+\eta+\alpha+\mu}{\sigma}I_2^*\\[1ex]
I_2^* &= \frac{\mu \sigma (\gamma_A+\mu +\sigma ) (\mu +\xi +\rho ) (\alpha +\gamma_I+\eta +\mu )(\mathcal{R}_0 -1)}{\splitfrac{\beta_A (\alpha +\gamma_I+\eta +\mu )+\beta_I \sigma ) (\mu (\gamma_A+\mu +\xi ) (\alpha +\gamma_I+\eta +\mu )}{+\alpha \sigma (\mu +\xi )+\mu \sigma (\gamma_I+\eta +\mu +\xi ))}}\\[1ex]
R_2^* &= \frac{\gamma_A(\gamma_I + \eta+\alpha+\nu)I_2^*+\sigma(I_2^*(\gamma_I+\eta)+b\nu+\rho S_2^*)}{\sigma(\mu+\rho)}
\end{align}

\end{document}


Unrelated : needless to load amsfonts when you load amssymb– the latter does it for you.