# equal size numerator and denominator

I am trying to size the numerator and denominator of the below equation so that they are equal in size. I have not had much luck suggestions are appreciated.

$$\sum_{i=1}^{n} \frac{\frac{cf_{n}}{(1+i)^n}} {\displaystyle\sum_{i=1}^{n}\frac{cf_n}{(1+i)^n}} , n_{i}$$

• Either remove \displaystyle or use \dfrac instead of \frac for the inner fractions. Sep 16, 2013 at 1:17

Probably you had added \displaystyle to get the superscript and subscript of the inner sum operator on top and below the symbol. This also increases the size of the fraction. Instead \limits can be used to move the superscript and subscript of the operator at the same place as in \displaystyle:

\documentclass{article}
\begin{document}
$\sum_{i=1}^{n} \frac{\frac{cf_{n}}{(1+i)^n}} {\sum\limits_{i=1}^{n}\frac{cf_n}{(1+i)^n}} , n_{i}$
\end{document}


The following example makes the four math style visible:

① \displaystyle
② \textstyle
③ \scriptstyle
④ \scriptscriptstyle

\documentclass{article}

\usepackage{pifont}
\usepackage{amstext}
\usepackage{color}
\newcommand*{\showms}{%
\mathchoice
{{\scriptscriptstyle\text{\color{red}\ding{172}}}}%
{{\scriptscriptstyle\text{\color{red}\ding{173}}}}%
{{\scriptscriptstyle\text{\color{red}\ding{174}}}}%
{{\scriptscriptstyle\text{\color{red}\ding{175}}}}%
}

\begin{document}
$\showms\sum_{\showms i=1}^{\showms n} \showms\frac{ \showms\frac{\showms cf_{\showms n}}{\showms (1+i)^{\showms n}} }{ \displaystyle \showms\sum_{\showms i=1}^{\showms n} \showms\frac{\showms cf_{\showms n}}{\showms(1+i)^{\showms n}} }\showms, n_{\showms i}$
$\showms\sum_{\showms i=1}^{\showms n} \showms\frac{ \showms\frac{\showms cf_{\showms n}}{\showms (1+i)^{\showms n}} }{ \showms\sum\limits_{\showms i=1}^{\showms n} \showms\frac{\showms cf_{\showms n}}{\showms(1+i)^{\showms n}} }\showms, n_{\showms i}$
\end{document}


Legend:

① \displaystyle
② \textstyle
③ \scriptstyle
④ \scriptscriptstyle

• This is great! I thought that all equations had to start with begin and end equation. What is the underlying structure of the command? This is very useful, thank you for your input Sep 19, 2013 at 1:26
• $$...$$ is used for numbered equations. $...$ or the environment form \begin{displaymath}...\end{displaymath} are used for unnumbered equations. $...$ or $$...$$ are used for inline math. Sep 19, 2013 at 2:18
• How to print legend in document?..It ok..did it :) Jul 26, 2015 at 20:26
• @someoneelse With amsmath we also have \begin{equation*} ... \end{equation*} and \begin{align*} ... \end{align*}. Mar 31, 2019 at 5:55

Alternatively from New command in TeX for fraction and Mathfixs package:

\documentclass{article}
\usepackage{mathfixs,amsmath,anyfontsize}
\makeatletter
\newcommand*{\fr}[1]{%
\fr@aux#1,,\@nil
}
\def\fr@aux#1,#2,#3\@nil{%
\ensuremath{\frac{#1}{#2}}%
}
\makeatother

\begin{document}
$\fr{\mbox{\fontsize{2mm}{2mm}\selectfont 5 - 2} ,\textstyle{\mbox{\fontsize{2mm}{2mm}\selectfont 6 - 1}}} = \fr{20,30}$
$\frac{\textstyle{\mbox{\fontsize{2mm}{2mm}\selectfont 5 - 2 }}}{\textstyle{\mbox{\fontsize{2mm}{2mm}\selectfont 6 - 1}} } = \frac{20}{30}$
\end{document}


Notice the difference in vertical alignment between numerator and denominator when using each of the methods.