2

I am having trouble with listing a couple of hundreds of long equations. Most of them need to be broken. The equations should be numbered. I tried many things such as eqnarray in combination with multline and as well I tried dmath. Here is what I have;

\documentclass{article}

\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{breqn}

\begin{document}

\begin{dgroup}
\begin{dmath}
\frac{dCitrate_{00000}}{dt} = ((Acetate_{00} * (J_{TCA} * (1 - P_{dil})) + DilutingPool_{00} * (J_{TCA} * P_{dil}))/(J_{TCA} *     (1 - P_{dil}) + J_{TCA} * P_{dil}) * (Oxaloacetate_{0000} + Oxaloacetate_{0001}) * J_{TCA} - J_{TCA} *     Citrate_{00000})/[Citrate]  
\end{dmath}
\begin{dmath}
\frac{dCitrate_{00001}}{dt} = ((Acetate_{00} * (J_{TCA} * (1 - P_{dil})) + DilutingPool_{00} * (J_{TCA} * P_{dil}))/(J_{TCA} *     (1 - P_{dil}) + J_{TCA} * P_{dil}) * (Oxaloacetate_{1000} + Oxaloacetate_{1001}) * J_{TCA} - J_{TCA} *     Citrate_{00001})/[Citrate] 
\end{dmath}
\begin{dmath}
\frac{dAcetylCoa_{01}}{dt} = 0 
\end{dmath}
\end{dgroup}


\end{document}

My first question is : Do I have to have \begin{dmath} ... \end{dmath} for each single equation? Also, the numbering does not look good:

enter image description here

Further, I would like to have the numbers in front of the equations and a numbering as 1,2,3... instead of 1a, 1b, 1c...

Does anyone know of a way to achieve this?

4

This looks suspiciously like chemistry to me so you may find one of the chemistry packages such as mchem helps. The math italic font is unsuitable for multi-letter identifiers as it is explicitly designed so that runs of letters do not look as if they are forming a word but rather look like an implied product of one-letter identifiers. I have used \mathrm below, although other choices are possible.

For best results you should probably use aligned and break "by hand" inserting \\ where necessary, however if you want an automated workflow that at least keeps things on the page, then a simple scheme using inline math linebreaking can be used as shown below.

Two versions one requiring you to add an alignment point &

enter image description here

\documentclass{article}

\usepackage{amsmath}

\makeatletter
\newenvironment{cmath}
{\baselineskip=1.5\baselineskip \begin{center}$\displaystyle\refstepcounter{equation}}
{\hspace{\@flushglue}\mbox{(\theequation)}\hspace{-\@flushglue}$\end{center}}


\newenvironment{cmathb}
{\[%
\halign\bgroup%
\global\setbox\@ne\hbox{$\displaystyle##{}$}%
\refstepcounter{equation}\global\setbox\thr@@\hbox{(\theequation)}%
\hfill\box\@ne&%
\vtop{\baselineskip=1.5\baselineskip \parindent\z@\rightskip\fill\parfillskip\z@
  \hsize\dimexpr\textwidth-\wd\@ne-\wd\thr@@\relax
   $\displaystyle{}##$\hfill\rlap{\box\thr@@}\hskip-\fill\hbox{}}\cr}%
{\crcr\egroup\]}
\makeatother

\begin{document}

\begin{cmath}
\frac{\mathrm{dCitrate}_{00000}}{\mathrm{dt}} = ((\mathrm{Acetate}_{00} * (J_{\mathrm{TCA}} * (1 - P_{\mathrm{dil}})) + \mathrm{DilutingPool}_{00} * (J_{\mathrm{TCA}} * P_{\mathrm{dil}}))/(J_{\mathrm{TCA}} *     (1 - P_{\mathrm{dil}}) + J_{\mathrm{TCA}} * P_{\mathrm{dil}}) * (\mathrm{Oxaloacetate}_{0000} + \mathrm{Oxaloacetate}_{0001}) * J_{\mathrm{TCA}} - J_{\mathrm{TCA}} *     \mathrm{Citrate}_{00000})/[\mathrm{Citrate}]
\end{cmath}
\begin{cmath}
\frac{\mathrm{dCitrate}_{00001}}{\mathrm{dt}} = ((\mathrm{Acetate}_{00} * (J_{\mathrm{TCA}} * (1 - P_{\mathrm{dil}})) + \mathrm{DilutingPool}_{00} * (J_{\mathrm{TCA}} * P_{\mathrm{dil}}))/(J_{\mathrm{TCA}} *     (1 - P_{\mathrm{dil}}) + J_{\mathrm{TCA}} * P_{\mathrm{dil}}) * (\mathrm{Oxaloacetate}_{1000} + \mathrm{Oxaloacetate}_{1001}) * J_{\mathrm{TCA}} - J_{\mathrm{TCA}} *     \mathrm{Citrate}_{00001})/[\mathrm{Citrate}]
\end{cmath}
\begin{cmath}
\frac{\mathrm{dAcetylCoa}_{01}}{\mathrm{dt}} = 0 
\end{cmath}

\bigskip
\hrule
\bigskip

\begin{cmathb}
\frac{d\mathrm{Citrate}_{00000}}{dt} &= ((\mathrm{Acetate}_{00} * (J_{\mathrm{TCA}} * (1 - P_{\mathrm{dil}})) + \mathrm{DilutingPool}_{00} * (J_{\mathrm{TCA}} * P_{\mathrm{dil}}))/(J_{\mathrm{TCA}} *     (1 - P_{\mathrm{dil}}) + J_{\mathrm{TCA}} * P_{\mathrm{dil}}) * (\mathrm{Oxaloacetate}_{0000} + \mathrm{Oxaloacetate}_{0001}) * J_{\mathrm{TCA}} - J_{\mathrm{TCA}} *     \mathrm{Citrate}_{00000})/[\mathrm{Citrate}]
\end{cmathb}
\begin{cmathb}
\frac{d\mathrm{Citrate}_{00001}}{dt} &= ((\mathrm{Acetate}_{00} * (J_{\mathrm{TCA}} * (1 - P_{\mathrm{dil}})) + \mathrm{DilutingPool}_{00} * (J_{\mathrm{TCA}} * P_{\mathrm{dil}}))/(J_{\mathrm{TCA}} *     (1 - P_{\mathrm{dil}}) + J_{\mathrm{TCA}} * P_{\mathrm{dil}}) * (\mathrm{Oxaloacetate}_{1000} + \mathrm{Oxaloacetate}_{1001}) * J_{\mathrm{TCA}} - J_{\mathrm{TCA}} *     \mathrm{Citrate}_{00001})/[\mathrm{Citrate}]
\end{cmathb}
\begin{cmathb}
\frac{d\mathrm{AcetylCoa}_{01}}{dt} &= 0 
\end{cmathb}


\end{document}
  • Many thanks for the quick answer, I especially like the look using \mathrm! Is there a way to align the equations at the "=" sign in the new cmath environment? Also, it would be nice if the next line after the linebreak would start after the "=".. – user1981275 Jun 22 '13 at 18:27
  • @user1981275 You could potentially wrap it all into an align environment (ditching the cmath environments) and prefixing & to each = to align there. – Sean Allred Jun 22 '13 at 18:33
  • 1
    @SeanAllred but then you lose the automatic line breaking unless I misunderstand what you mean? – David Carlisle Jun 22 '13 at 18:35
  • @user1981275 you could, perhaps although it depends how far it is worth going. As I said in the answer if you really need to fine-tune the alignments then using an equation environment containing an aligned will give you full control, but you have to add the \\ to specify break points. – David Carlisle Jun 22 '13 at 18:37
  • Since I have a few hundreds of equations, I would rather prefer automated linebreaking. – user1981275 Jun 22 '13 at 18:38

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.