6

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}
  • 2
    Either remove \displaystyle or use \dfrac instead of \frac for the inner fractions. – Qrrbrbirlbel Sep 16 '13 at 1:17
19

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

  • 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 – someoneelse Sep 19 '13 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. – Heiko Oberdiek Sep 19 '13 at 2:18
  • How to print legend in document?..It ok..did it :) – Levan Shoshiashvili Jul 26 '15 at 20:26
  • @someoneelse With amsmath we also have \begin{equation*} ... \end{equation*} and \begin{align*} ... \end{align*}. – L. F. Mar 31 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.