[Tex/LaTex] How to get display style in both numerator/denominator in a fraction

fractionsmath-mode

Test code:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsmath}
\begin{document}
\begin{equation}
  z = \frac{\sum_{i=1}^N{x_i}}{\sum_{i=1}^N{y_i}}
\end{equation}
\begin{equation}
  z = \dfrac{\sum_{i=1}^N{x_i}}{\sum_{i=1}^N{y_i}}
\end{equation}
\begin{equation}
  z = \tfrac{\sum_{i=1}^N{x_i}}{\sum_{i=1}^N{y_i}}
\end{equation}
\end{document}

results in equations that look like this:

enter image description here

They all just look like different variations of a compressed style as opposed to what I get if I use this:

\begin{equation}
    z = \frac{\displaystyle\sum_{i=1}^N{x_i}}{\displaystyle\sum_{i=1}^N{y_i}}
\end{equation}

which results in:

enter image description here

Is sprinkling \displaystyle around the only get to get this last style?

Best Answer

When in a display, such as equation, there's no difference between \frac and \dfrac; LaTeX will typeset the fraction with numerator and denominator in text style, which accounts for the placement of limits in the summation.

You can define a \Dfrac command:

\newcommand{\Dfrac}[2]{%
  \dfrac{\displaystyle #1}{\displaystyle #2}%
}

if you really need such big objects.

The general rule is that numerator and denominator in a fraction are typeset in the immediately following style of the current one:

display → text
text → script
script → scriptscript
scriptscript → scriptscript

With \dfrac or \tfrac you only override the current style, to use respectively display and text style.

Related Question