8

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.

\begin{equation}
\sum_{i=1}^{n} \frac{\frac{cf_{n}}{(1+i)^n}} {\displaystyle\sum_{i=1}^{n}\frac{cf_n}{(1+i)^n}} , n_{i}
\end{equation}
1
  • 2
    Either remove \displaystyle or use \dfrac instead of \frac for the inner fractions. Commented Sep 16, 2013 at 1:17

2 Answers 2

23

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}

Result

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}

Result with math styles

Legend:

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

4
  • 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 Commented Sep 19, 2013 at 1:26
  • \begin{equation}...\end{equation} is used for numbered equations. \[...\] or the environment form \begin{displaymath}...\end{displaymath} are used for unnumbered equations. $...$ or \(...\) are used for inline math. Commented Sep 19, 2013 at 2:18
  • How to print legend in document?..It ok..did it :) Commented Jul 26, 2015 at 20:26
  • @someoneelse With amsmath we also have \begin{equation*} ... \end{equation*} and \begin{align*} ... \end{align*}.
    – L. F.
    Commented Mar 31, 2019 at 5:55
0

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.

Solution but with internal alignment difference

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .