0

I have a system of equations where the equations are big (one line isn't enough). I found this solution (the second one, from egreg How to align a set of very long equations) to manage the "how to align long equations ?" problem but I still have some troubles.

My equations are "just" sums of different elements, and some of these elements are big products (again, one line isn't enough).

Example (how to show the result of this code ?)

\documentclass[a4paper]{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
    \begin{split}
        A &= AAAAAAAAAAAAAAAAAAAAAA \cdots \\
        &\qquad -BBBBBBBBBBBB\cdots\\
        & +\\
        &\qquad CCCCCCCCCCCCCCCCCCCCCCCCC\\
        & \times\\
        &\qquad CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
    \end{split}
    \begin{split}
        A &= AAAAAAAAAAAAAAAAAAAAAA \cdots \\
        &\qquad -BBBBBBBBBBBB\cdots\\
        & +\\
        &\qquad CCCCCCCCCCCCCCCCCCCCCCCCC\\
        & \times\\
        &\qquad CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
    \end{split}
\end{align}
\end{document}

What are the conventions in this case ? If it's possible, I want to center the + and x and maybe add brackets for (CCCC x CCCC) to show it's only one element of the sum. I suppose I have to nest an environment in one other but I don't know which environments.

I tried some things without success, but it may help you to understand what I mean Try 1

\documentclass[a4paper]{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
    \begin{split}
        A &= AAAAAAAAAAAAAAAAAAAAAA \cdots \\
        &\qquad -BBBBBBBBBBBB\cdots\\
        & \center{+}\\
        \left\(\begin{split}
            &\qquad CCCCCCCCCCCCCCCCCCCCCCCCC\\
            & \center{\times}\\
            &\qquad CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
        \end{split}\right\)
    \end{split}
\end{align}
\end{document}

Try 2

\documentclass[a4paper]{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
    \begin{split}
        A &= AAAAAAAAAAAAAAAAAAAAAA \cdots \\
        &\qquad -BBBBBBBBBBBB\cdots\\
        & \center{+}\\
        \left\(\begin{gather}
            \qquad CCCCCCCCCCCCCCCCCCCCCCCCC\\
             \center{\times}\\
            \qquad CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
        \end{gather}\right\)
    \end{split}
\end{align}
\end{document}

EDIT :

As requested : here are some pictures to show what I have in mind. It may be no standard and if so, please tell me what is the "right" way.

Output of what I want

And an example of a true equation.

enter image description here

The first one doesn't have multiplicative symbol and a term is too long. But if I add the symbols and cut automatically the equation (Use equation and cases for big and numerous equation) the equation is less clear.

EDIT 2 As requested : here is the code to reproduce the "real" problem (not the equations I showed)

\documentclass[a4paper]{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
    \begin{split}
        \dot{\text{R5P}} =& \nu_\text{maxVG6PDH}\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}} \\
        +& \nu_\text{maxVG6PDH}\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}} \\
        -& \nu_\text{maxVG6PDH}\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}} \\
    \end{split}\\
    \begin{split}
        \dot{\text{R5P}} =& \nu_\text{maxVG6PDH}\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}} \\
        +& \nu_\text{maxVG6PDH}\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}} \\
        -& \nu_\text{maxVG6PDH}\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}}\cdot\frac{G6P}{K_{mG6P}^{VG6PDH}} \\
    \end{split}
\end{align}

\end{document}
  • 3
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – dexteritas Jun 7 '18 at 14:22
  • \center{\times} whatever the intention of that code, it will not do what was intended. \center does not take an argument it is the internal implementaion of \begin{center} and should never be used on command form and certainly never in math. – David Carlisle Jun 7 '18 at 14:31
  • you can not have gather inside math, that is a top level display environment – David Carlisle Jun 7 '18 at 14:33
  • @DavidCarlisle (sorry I'm little slow, my english isn't very good) I have something in mind but I don't know how to explain it better than I did. I think the best thing for you to do is to answer how you would write the equations A = AAAAAAAA + BBBBBBBB + CCCCCCC x CCCCCCCC, A2 = AAAAAAAAAA2 + BBBBBBBBBBB2 + CCCCCCCC2 x CCCCCCC2. – Ccile Jun 7 '18 at 14:46
  • @Ccile, ok. So how do you want to rearrange? I mean visually, will take care of the code later. – gvgramazio Jun 9 '18 at 9:08
4

It is very hard to guess the intended output from the code shown. The code below runs without error and produces the following slightly odd looking output, which hopefully will give you a start in the right direction.

enter image description here

\documentclass[a4paper]{article}
\usepackage{mathtools}

\begin{document}
\begin{align*}
        A &= AAAAAAAAAAAAAAAAAAAAAA \cdots \\
        &\qquad -BBBBBBBBBBBB\cdots\\
        &+\\
        &\left(\begin{gathered}
            CCCCCCCCCCCCCCCCCCCCCCCCC\\
             \times\\
             CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
    \end{gathered}\right)
\end{align*}
\end{document}
  • Ah gatherED and not gather... How do you make the result appears ? You say it's odd, but how would you manage such an equation ? – Ccile Jun 7 '18 at 14:48
  • @Ccile to show output clip part of a screenshot of your previewer and then upload the image, at the very least I would put the + to the left of the ( not on a line on its own, otherwise hard to say with stub terms like CCCCC most likely I would not put the product into a separate gathered but just wrap the whole expression as you would an inline expression. – David Carlisle Jun 7 '18 at 15:05
0

You can use the whole line-width for a single term at least:

\documentclass[a4paper]{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
    &A1 = \notag \\
    &\begin{aligned}
        & AAAAAAAAAAAAAAAAAAAAAA \cdots \\
        & -BBBBBBBBBBBB\cdots\\
        & +CCCCCCCCCCCCCCCCCCCCCCCCC\\
        & \times CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
    \end{aligned} \\[1ex]
    &A2 = \notag \\
    &\begin{aligned}
        & AAAAAAAAAAAAAAAAAAAAAA \cdots \\
        & -BBBBBBBBBBBB\cdots\\
        & +CCCCCCCCCCCCCCCCCCCCCCCCC\\
        & \times CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
    \end{aligned} 
\end{align}

\end{document}

enter image description here

0

Is this of any help? I propose two solution, the first one with align and split, the second one with multline.

Example with align and split:

example_1

Example with multline:

example_2

Code to generate both:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
You could use \texttt{align} with \texttt{split}.
\begin{align}
  \begin{split}
    \dot{R5P} =& v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
              +& v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
              +& v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
              +& v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
              +& v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}
  \end{split} \\
  \begin{split}
    \dot{R5P} =& v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
              +& v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
              +& v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
              +& v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
              +& v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}
  \end{split}
\end{align}
\newpage
Or you could use \texttt{multline} environment.
\begin{multline}
  \dot{R5P} = v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
            + v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
            + v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
            + v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
            + v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}
\end{multline}
\begin{multline}
  \dot{R5P} = v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
            + v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
            + v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
            + v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}\\
            + v_{max} \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}} \cdot \frac{G6P}{K_{mG6P}^{VG6PDH}}
\end{multline}
\end{document}

Note that if you want more customization, the actual code of your equation will be necessary. I mean the code for the plain equation that doesn't fit in the page.

  • I use align and split but there is a problem with the terms that don't fit the page. I'll edit the main post to give a more realistic code of my equations. – Ccile Jun 10 '18 at 17:17
  • @Ccile simply put also the terms of multiplication on a new line. However, IMHO, an equation 10 rows long should be avoided if possible. You could write it grouping the terms and use other equation for those terms. – gvgramazio Jun 11 '18 at 9:00
0

I suggest that you use the breqn package, which is specifically designed to typeset long equations, with automatic line-breaking and improved alignment.

The desired output is not clear to me, but I provide an example below (and on Overleaf), using dgroup*, with dmath* sub-environments. You should be able to modify this to obtain your desired effect:

\documentclass[a4paper]{article}

\usepackage{breqn}

\begin{document}
  \begin{dgroup*}
      \begin{dmath*}
          A = AAAAAAAAAAAAAAAAAAAAAA \cdots
          \qquad -BBBBBBBBBBBB\cdots
          +
          \qquad CCCCCCCCCCCCCCCCCCCCCCCCC
          \times
          \qquad CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
      \end{dmath*}
      \begin{dmath*}
          A = AAAAAAAAAAAAAAAAAAAAAA \cdots
          \qquad -BBBBBBBBBBBB\cdots
          +
          \qquad CCCCCCCCCCCCCCCCCCCCCCCCC
          \times
          \qquad CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
      \end{dmath*}
  \end{dgroup*}
\end{document}

Image of the result of the above code, when compiled with pdflatex.

  • About the "desired output" : what would you do to write this type of equations ? (where AAAA BBBB and CCC are supposed to be very big) – Ccile Jun 7 '18 at 14:57
  • @Ccile Well, I think that the Overleaf example I provided is a good start. I suggest you look through the breqn manual and tune it to your liking. – Coby Viner Jun 7 '18 at 15:21
  • 1
    I do not understand the downvote and just undid it. People may not like the package, but I do not find it appropriate to penalize mentioning it. – user121799 Jun 13 '18 at 1:05
  • @marmot I think that is mostly because the example is hosted on overleaf. If possible, one should show both code and result here instead that on overleaf. – gvgramazio Jun 22 '18 at 17:15
  • @gvgramazio This strikes me as unreasonable, especially given that Overleaf is widely-used, portable, and convenient. It requires a single click-through to a well-established and trustworthy website, which facilitates reuse and rapid interactive refinement or refactoring of the LaTeX code. Notwithstanding, I have revised my answer to add the code and its (pdflatex) rendered output, per your request. – Coby Viner Jun 23 '18 at 4:06

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.