26

I used the split command to break my equation but I receive the error:

! Missing } inserted.
<inserted text> 
                }
l. \end {split}

The code in .tex file is as follows:

\begin{equation} \label{eq:5} 
\begin{split} 
A =1-&\frac{h_{FS}p_{I}p_{DN}p_{FS} +h_{F}p_{I}p_{DN}p_{F} + h_{UNC}p_{I}p_{UN}}{h_{G}+h_{V}+p_{I}(h_{I}+h_{DMC}p_{DM}+h_{UNC}p_{UN}+h_{UMC}p_{UM}+h_{DNC}p_{DN}+h_{FS}p_{DN}p_{FS} +\\
 &h_{GD}p_{DN}p_{GD} + h_{F}p_{DN}p_{F})}  
\end {split}
\end{equation}

Actually, I can see the produced equation in the PDF and it's
correct but this error exists. I want to submit my source file to a journal, but the PDF cannot be generated in the submission process. Any help is really appreciated.

David Carlisle
  • 757,742
Mary
  • 261
  • \begin{equation}\label{eq:5} \begin{split} A =1-&\frac{h_{FS}p_{I}p_{DN}p_{FS} +h_{F}p_{I}p_{DN}p_{F} + h_{UNC}p_{I}p_{UN}}{h_{G}+h_{V}+p_{I}(h_{I}+h_{DMC}p_{DM}+h_{UNC}p_{UN}+h_{UMC}p_{UM}+h_{DNC}p_{DN}+h_{FS}p_{DN}p_{FS} +\ &h_{GD}p_{DN}p_{GD} + h_{F}p_{DN}p_{F})} \end {split} \end{equation} – Mary Sep 27 '12 at 02:20
  • 1
    You can't split the second part of a \frac on two line unless you put it inside something like a \parbox – Peter Grill Sep 27 '12 at 02:23

4 Answers4

29

You could use the \splitfrac instruction of the mathtools package to split the long denominator into two lines. Note that you needn't employ a split environment in this case. I've increased the size of the round parentheses used in the denominator (via \bigl and \bigr instructions) to give them a bit more visibility. I would also typeset all subscript terms in math-roman instead of the standard (math) italics.

enter image description here

\documentclass{article}
\usepackage{mathtools} % mathtools builds on and extends amsmath package
\newcommand\vn[1]{^{}_{\mathrm{#1}}} % (subscript-level) variable names
\begin{document}

\begin{equation} \label{eq:5} A = 1-\frac{h\vn{FS}p\vn{I}p\vn{DN}p\vn{FS} +h\vn{F}p\vn{I}p\vn{DN}p\vn{F} + h\vn{UNC}p\vn{I}p\vn{UN}}{% \splitfrac{\textstyle % turn off cramped denom. style h\vn{G}+h\vn{V}+p\vn{I} \bigl( h\vn{I}+h\vn{DMC}p\vn{DM} +h\vn{UNC}p\vn{UN}+h\vn{UMC}p\vn{UM}} {\textstyle % turn off cramped denom. style +h\vn{DNC}p\vn{DN}+h\vn{FS}p\vn{DN}p\vn{FS} +h\vn{GD}p\vn{DN}p\vn{GD} + h\vn{F}p\vn{DN}p\vn{F} \bigr)}} \end{equation} \end{document}

Mico
  • 506,678
18

The other answers give you what you wanted (+1 to both), but for what it's worth, I would consider tackling this using local definitions to make it a little easier to read

screenshot

\documentclass{article}
\usepackage{mathtools} % mathtools builds on and extends amsmath package
\begin{document}

\begin{equation} \label{eq:5} 
    A = 1-\frac{f(h,p)}{g(h,p)}
\end{equation}
where
\begin{align*}
    f(h,p) & =h_{FS}p_{I}p_{DN}p_{FS} +h_{F}p_{I}p_{DN}p_{F} + h_{UNC}p_{I}p_{UN}                                    \\
    g(h,p) & =h_{G}+h_{V}+p_{I}\left( h_{I}+h_{DMC}p_{DM}+h_{UNC}p_{UN}+h_{UMC}p_{UM}\right.                         \\
           & \phantom{ {}= } + \left. h_{DNC}p_{DN}+h_{FS}p_{DN}p_{FS} +h_{GD}p_{DN}p_{GD} + h_{F}p_{DN}p_{F}\right) 
\end{align*}
\end{document}
cmhughes
  • 100,947
  • In the present case, the \left( ... \right. and \left. ... \right) don't actually increase the size of the parentheses. It may be better to use \big statements instead. – Mico Sep 27 '12 at 13:47
  • @Mico thanks for the feedback; I view \big as a bit too manual though, perhaps that's just me :) – cmhughes Sep 27 '12 at 15:58
  • Great answer, Chris! :) I think this is the cleanest way to tackle this expression. :) – Paulo Cereda Sep 28 '12 at 01:08
  • @PauloCereda thanks a lot :) I always appreciate your positivity :) – cmhughes Sep 28 '12 at 01:26
11

Here's a TeXy way (amsmath will nag though if you're using it, IIRC.):

A = 1-{h_{FS}p_Ip_{DN}p_{FS} +h_Fp_Ip_{DN}p_F + h_{UNC}p_Ip_{UN}
  \over\displaystyle{
  h_G+h_V+p_I\big( h_I+h_{DMC}p_{DM}+h_{UNC}p_{UN}+h_{UMC}p_{UM}
  \atop\quad
  {}+h_{DNC}p_{DN}+h_{FS}p_{DN}p_{FS}+h_{GD}p_{DN}p_{GD}+h_Fp_{DN}p_F\big)}}

enter image description here

morbusg
  • 25,490
  • 4
  • 81
  • 162
10

If you place the denominator of the \frac with a \parbox then you can have a new line in it:

enter image description here

Code:

\documentclass{article}
\usepackage{amsmath}

\begin{document} \begin{equation} \label{eq:5} A =1-\frac{h_{FS}p_{I}p_{DN}p_{FS} +h_{F}p_{I}p_{DN}p_{F} + h_{UNC}p_{I}p_{UN}}{\parbox{4.2in}{$h_{G}+h_{V}+p_{I}(h_{I}+h_{DMC}p_{DM}+h_{UNC}p_{UN}+h_{UMC}p_{UM}+h_{DNC}p_{DN} +$ \ \hspace*{2.1cm}$h_{FS}p_{DN}p_{FS} + h_{GD}p_{DN}p_{GD} + h_{F}p_{DN}p_{F})$}} \end{equation} \end{document}

Peter Grill
  • 223,288