# Fit equations as same size of the text fonts

An inline equation is written with the sentence appears,

It can be noticed the line spacing has been locally increased for that particular sentence containing the variable E. How to shrink the equation automatically to appear perfectly inline without changes in line spacing?

• A first step could be to drop \displaystyle or use only \frac instead of \dfrac in the in-line math expression. Feb 15, 2014 at 13:29
• True. I have unknowingly used \displaystyle. Without it appears fine. You could post it as an answer!
– SKPS
Feb 15, 2014 at 13:32
• You really need to show the markup in cases like this. Feb 16, 2014 at 0:15

Using \displaystyle or \dfrac inside in-line math equations can have this unwanted side effect. You are better with only \frac. It can also be preferable to use manually scaled delimiters instead of automatic scaling.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}

\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

\begin{document}
[\ldots] where $\rho$ is the fluid density, $\vec{u}$ is the velocity, $E=\bigl(e+\frac{\norm{\vec{u}}_2^2}{2}\bigr)$ is the total specific energy per unit mass and $e$ is the specific internal energy. [\ldots]
\end{document}


As an alternative you could write $E=\bigl(e+\frac{1}{2}\norm{\vec{u}}_2^2}\bigr)$.

When writing equations in inline-math mode, don't use \dfrac ("display-style fractions"). Use either \frac, e.g., \frac{1}{2}, or use the "slanted division symbol", i.e., $(1/2)$.

Below are three possible solutions for the paragraph you've provided. The first solution uses \frac{1}{2}. Note that I would not place the squared norm term on the numerator of the fractional expression for inline-math expressions, as doing so will almost certainly make it impossible to preserve single-spacing of the lines of text in the paragraph. The second solution uses (1/2), and the third economizes a bit on notation by dividing the squared norm term by 2, inline-math style.

Select whichever solution best suits your style.

\documentclass{article}
\usepackage{mathtools} % for \DeclarePairedDelimiter macro
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\begin{document}

\noindent
where $\rho$ is the fluid density, $\vec{u}$ is the velocity, $E=(e+\frac{1}{2}\norm{\vec{u}}_2^2)$ is the total specific energy per unit mass, and $e$ is the specific internal energy. The objective is to calculate the primitive variables \dots

\noindent
where $\rho$ is the fluid density, $\vec{u}$ is the velocity, $E=(e+(1/2)\norm{\vec{u}}_2^2)$ is the total specific energy per unit mass, and $e$ is the specific internal energy. The objective is to calculate the primitive variables \dots

\noindent
where $\rho$ is the fluid density, $\vec{u}$ is the velocity, $E=(e+\norm{\vec{u}}_2^2/2)$ is the total specific energy per unit mass, and $e$ is the specific internal energy. The objective is to calculate the primitive variables \dots
\end{document}

• IMHO, Of there, certainly the easiest to read and understand is the 1st one, which is certainly better than putting tne norm into the nominator.
– yo'
Feb 15, 2014 at 14:17
• @tohecz - Thanks! I could have gone farther and also eliminated the outer parentheses, as they don't really do much (except add clutter...).
– Mico
Feb 15, 2014 at 14:27

If you find text fractions too small, the nccmath package defines "medium maths" commands and environments (about 80 % of displaystyle). These usually do not increase the interline spacing. In the worst case you can have to increase the \baselinestretch by a few percents with the help of the setspace package (for the whole document). The following code will let you compare \tfracand \mfrac:

        \documentclass[12pt]{article}

\usepackage{mathtools} %
\usepackage{nccmath}
\usepackage{setspace}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

\usepackage{nccmath}
\usepackage{setspace}
\setstretch{1.1}

\begin{document}

\noindent
where $\rho$ is the fluid density, $\vec{u}$ is the velocity, $E=e+\mfrac{\norm{\vec{u}}_2^2 }{2}$ is the total specific energy per unit mass, and $e$ is the specific internal energy. The objective is to calculate the primitive variables \dots

\noindent
where $\rho$ is the fluid density, $\vec{u}$ is the velocity,  $E=e+\frac{\norm{\vec{u}}_2^2 }{2}$ is the total specific energy per unit mass, and $e$ is the specific internal energy. The objective is to calculate the primitive variables \dots
\end{document}