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}
Ccile
  • 400
  • 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 07 '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 07 '18 at 14:31
  • you can not have gather inside math, that is a top level display environment – David Carlisle Jun 07 '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 07 '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 09 '18 at 09:08
  • @Ccile, First thing. when you have a long equation you have to break where there is an operator (+,-,/,etc.). You should put the operator on the new line or in both line but in a way that make sense: if your operator is + you should put + at the end of the old line and + at the beginning of the new line, if your operator is - you should put + (and not -) at the end of the old line and - at the beginning of the new line. Personally I prefer the first style (the operator on the new line only). – gvgramazio Jun 09 '18 at 09:13
  • @gvgramazio I want to rearrange it as in the first picture (with AAAA and so one). I was told that it's better to have three dots at the end of the line and the symbol (+ or -) at the beginning of the new line. For the products I don't know. – Ccile Jun 09 '18 at 17:52
  • @Ccile, since you asked also for suggestion I could say that what is represented in that figure is ugly, misleading and probably also wrong from a math point of view. Sorry if I'm too rude. – gvgramazio Jun 10 '18 at 10:48

4 Answers4

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}
David Carlisle
  • 757,742
  • 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 07 '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 07 '18 at 15:05
1

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.

Coby Viner
  • 1,939
  • 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 07 '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 07 '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. –  Jun 13 '18 at 01:05
  • @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 04:06
  • @gvgramazio Well, to some extent I take your point. But my Overleaf demos are not essential to my answers that use them and it saves me time (expended on a volunteer endeavour!)… Further, I never edit those projects further. I also do not really find it any more of less likely that Overleaf would fold, vs. TeX.SE… Regardless, I would point out that my answer did not have its downvote undone nor any upvotes, and this issue was not raised on other similarly-linked questions, so I'm not sure that many share your concern. (This should probably have been discussed on meta; sorry for not doing so.) – Coby Viner Jun 23 '18 at 19:40
  • @gvgramazio Yes, I realize that—thanks! I And certainly I take your point overall, but feel this was a reasonable exception. – Coby Viner Jun 23 '18 at 20:28
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

AboAmmar
  • 46,352
  • 4
  • 58
  • 127
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.

gvgramazio
  • 2,660
  • 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 09:00