# Problem with \frac macro

I am using this code for a mathematics problem. The code works but the lower fraction looks really dull, the parenthesis is doing something it isn't supposed to. What I can do about this?

\begin{align}
D &= \sum_{i}^{k}\frac{n_i}{\frac{A}({\Delta\sigma_i})^m} \nonumber \\
D &= \sum_{i}^{k}\frac{n_i}{\frac{A}({r_i*\Delta\sigma_{max}})^m} \nonumber \\
D &= \frac{(\Delta\sigma_{max})^m}{A} \sum_{i}^{k}\frac{n_i}{(r_i)^m} \nonumber \\
D &= \frac{(\Delta\sigma_{max})^m}{A} * C \label{eq:constant}
\end{align}


• Welcome to the site. If you indent your code 4 spaces, it shows as code. Alternately, highlight it and click on the {} icon at the top of the editing box. – Steven B. Segletes Jan 21 '15 at 12:33
• In your first two equations, it is not clear whether you want the whole denominator to have the exponent or only the denominator of the denominator. – Steven B. Segletes Jan 21 '15 at 12:37
• The problem is {\frac{A}({\Delta\sigma_i})^m}. The correct syntax for \frac is \frac{above}{below}. In your code ( is the denominator, which is not what you want ;) – JBantje Jan 21 '15 at 12:40
• Please include a complete minimum working example. (Your LaTeX is non-standard as it relies on amsmath.) – user10274 Apr 22 '15 at 11:57
• Remember to accept the answer you find most useful (if, indeed, any of them are useful to you). – Svend Tveskæg May 20 '15 at 0:22

Here's an alternative presentation to avoid fractions within fractions. EDITED to reflect clarified intent of the OP in the comment section.

Also, use \max instead of max, since it is a function.

REEDITED to take Mico's suggestion of using \cdot rather than the *. That is, perhaps, assuming something on the intent of the OP, but it seems a reasonable assumption.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
D &= \sum_{i}^{k}n_i\cdot\frac{({\Delta\sigma_i})^m}{A}\nonumber \\
D &= \sum_{i}^{k}n_i\cdot\frac{({r_i\cdot\Delta\sigma_{\max}})^m}{A} \nonumber \\
D &= \frac{(\Delta\sigma_{\max})^m}{A} \sum_{i}^{k}\frac{n_i}{(r_i)^m} \nonumber \\
D &= \frac{(\Delta\sigma_{\max})^m}{A}\cdot C \label{eq:constant}
\end{align}
\begin{align}
D &= \sum_{i}^{k}\frac{n_i}{\frac{A}({\Delta\sigma_i})^m} \nonumber \\
D &= \sum_{i}^{k}\frac{n_i}{\frac{A}({r_i*\Delta\sigma_{max}})^m} \nonumber \\
D &= \frac{(\Delta\sigma_{max})^m}{A} \sum_{i}^{k}\frac{n_i}{(r_i)^m} \nonumber \\
D &= \frac{(\Delta\sigma_{max})^m}{A} * C \label{eq:constant}
\end{align}
\end{document}


• Thanks alot, it was the first version i would like to have. – user70916 Jan 21 '15 at 12:57
• @user70916 EDITED to reflect your intent. – Steven B. Segletes Jan 21 '15 at 13:18
• I'd be tempted either to get rid of the asterisks entirely or to replace them \cdot. – Mico Apr 22 '15 at 1:55
• @yo' - For a good example of when to use thinspace instead of any kind of multiplication symbol, see the posting tex.stackexchange.com/q/239942/5001... – Mico Apr 22 '15 at 23:03
• @StevenB.Segletes Excuse me very much. :-( I have not seen the original question. I will delete all. – Sebastiano Feb 21 '19 at 17:05

I corrected the placement of the parenthesis in your code:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
D &= \sum_{i}^{k}\frac{n_i}{\frac{A}{(\Delta\sigma_i)^m}} \nonumber \\
D &= \sum_{i}^{k}\frac{n_i}{\frac{A}{(r_i*\Delta\sigma_{max})^m}} \nonumber \\
D &= \frac{(\Delta\sigma_{max})^m}{A} \sum_{i}^{k}\frac{n_i}{(r_i)^m} \nonumber \\
D &= \frac{(\Delta\sigma_{max})^m}{A} * C \label{eq:constant}
\end{align}
\end{document}


Result:

Here is how I would do it:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\noindent Either
\begin{align}
\label{eq:constant:A}
D &= \sum_{i = \cdots}^{k} \frac{n_{i} \cdot (\Delta\sigma_{i})^{m}}{A} \nonumber \\
&= \sum_{i = \cdots}^{k} \frac{n_{i} \cdot (r_{i} \cdot \Delta\sigma_{\max})^{m}}{A} \nonumber \\
&= \frac{(\Delta\sigma_{\max})^{m}}{A} \cdot \sum_{i = \cdots}^{k}\frac{n_{i}}{{r_{i}}^{m}} \nonumber \\
&= \frac{(\Delta\sigma_{\max})^{m}}{A} \cdot C
\end{align}
or
\begin{align}
\label{eq:constant:B}
D &= \sum_{i = \cdots}^{k} \frac{n_{i}(\Delta\sigma_{i})^{m}}{A} \nonumber \\
&= \sum_{i = \cdots}^{k} \frac{n_{i}(r_{i}\Delta\sigma_{\max})^{m}}{A} \nonumber \\
&= \frac{(\Delta\sigma_{\max})^{m}}{A}\sum_{i = \cdots}^{k}\frac{n_{i}}{{r_{i}}^{m}} \nonumber \\
&= \frac{(\Delta\sigma_{\max})^{m}}{A}C
\end{align}

\end{document}


If the margins in your document are a bit smaller, you can consider doing the following:

\documentclass{article}

\usepackage{geometry}
\usepackage{mathtools}

\begin{document}

\noindent Another solutiuon using the \texttt{geometry} package to avoid the formulae going into the margin:
\begin{align}
\label{eq:constant:A}
D &= \sum_{i = \cdots}^{k} \frac{n_{i} \cdot (\Delta\sigma_{i})^{m}}{A}
= \sum_{i = \cdots}^{k} \frac{n_{i} \cdot (r_{i} \cdot \Delta\sigma_{\max})^{m}}{A}
= \frac{(\Delta\sigma_{\max})^{m}}{A} \cdot \sum_{i = \cdots}^{k}\frac{n_{i}}{{r_{i}}^{m}}
= \frac{(\Delta\sigma_{\max})^{m}}{A} \cdot C
\intertext{or}
\label{eq:constant:B}
D &= \sum_{i = \cdots}^{k} \frac{n_{i}(\Delta\sigma_{i})^{m}}{A}
= \sum_{i = \cdots}^{k} \frac{n_{i}(r_{i}\Delta\sigma_{\max})^{m}}{A}
= \frac{(\Delta\sigma_{\max})^{m}}{A}\sum_{i = \cdots}^{k}\frac{n_{i}}{{r_{i}}^{m}}
= \frac{(\Delta\sigma_{\max})^{m}}{A}C
\end{align}

\end{document}


Notes:

• There is only one D in each approach.
• There is no fraction within a fraction in either approach.
• In the solution at the top, the *s are replaced by \cdots.
• In the solution at the bottom, all the \cdots are removed.

P.S. Rememeber to replace the \cdots.