I know this is an issue that comes up frequently, but I keep running into issues using all the suggested examples (breqn, amsmath; split, align, etc).
Here's what I have:
\documentclass[11pt]{article}
\usepackage[margin=1in,paperwidth=8.5in,paperheight=11in]{geometry}
\usepackage[shortlabels]{enumitem}
\usepackage{amsmath}
\usepackage{xfrac}
\usepackage{breqn}
\begin{document}
% << Other stuff that compiled fine. >>
\begin{enumerate}[(a)]
\item What is the global CPI for each implementation?
We can use this equation to find the overall CPI for each implementation:
\begin{equation}
\begin{align*}
CPI_{total} & = \frac{\sum (IIC) (CCI)}{IC} \\
CPI_{P1,total} &=
\frac{(1 \times 10^5~class~instructions \cdot 1~\sfrac{cycle}{instruction}) \\+
(2 \times 10^5~class~instructions \cdot 2~\sfrac{cycles}{instruction}) \\+
(5 \times 10^5~class~instructions \cdot 3~\sfrac{cycles}{instruction}) \\+
(2 \times 10^5~class~instructions \cdot 3~\sfrac{cycles}{instruction})}
{1 \times 10^6~instructions} \\
& = 2.6~\sfrac{average~cycles}{instruction} \\
CPI_{P2,total} & =
\frac{(1 \times 10^5~class~instructions \cdot 2~\sfrac{cycles}{instruction}) \\+
(2 \times 10^5~class~instructions \cdot 2~\sfrac{cycles}{instruction}) \\+
(5 \times 10^5~class~instructions \cdot 2~\sfrac{cycles}{instruction}) \\+
(2 \times 10^5~class~instructions \cdot 2~\sfrac{cycles}{instruction})}
{1 \times 10^6~instructions}
& = 2.0~\sfrac{average~cycles}{instruction} \\
\end{align*}
\end{equation}
% << More list items >>
\end{enumerate}
\end{document}
The code does fall within an enumerated list, but commenting out the list doesn't seem to affect it. The code also compiles OK when the attempts at splitting are removed and I just align them with eqnarray
.
I'm getting a Paragraph ended before \align was complete
error.
EDIT: question formatting.
EDIT2: Progress!
OK, so I figured out how to use splitfrac
after some searching-- \frac{ \splitfrac{<numsplit1>}{<numsplit2>} } {<denom>}
-- using the code here:
\begin{eqnarray*}
CPI_{total} &=& \frac{\sum (IIC) (CCI)}{IC} \\
&=& \frac{\splitfrac{(1 \times 10^5~instructions \cdot 1~\sfrac{cycle}{instruction})+(2 \times 10^5~instructions \cdot 2~\sfrac{cycles}{instruction})}{+(5 \times 10^5~instructions \cdot 3~\sfrac{cycles}{instruction})+(2 \times 10^5~instructions \cdot 3~\sfrac{cycles}{instruction})}}{1 \times 10^6~instructions} \\
\end{eqnarray*}
This compiles OK, but it gives me this extraneous and distracting 1
in the numerator, seen below:
Any idea what's happening here?
align*
, that is not allowed.! Package amsmath Error: Erroneous nesting of equation structures;
align
insideequation
; you cannot leave blank lines inside a displayed math environment such asalign
; you cannot use line change commands (\\
) inside the arguments of\frac
.equation
and eliminated the extra line breaks. Without breaking the equation in any way, it goes right off the page shortly after the first addend in thefrac
. How can one split a numerator to fit on one page?