[Tex/LaTex] Latex longtable, start equation on new line

line-breakinglongtablemath-mode

I'm trying to get an equation go to a new line in a table, in latex.

Basically I want it look something like this:

  column 1         column 2               column 3
(equation)          (text)               (equation)

  A+B+C           quite long text         A+B+C,  A=B+C,
                  that gets split up              B=D-G
                  as you write

  B+G+H+J         more long text that    A+Y+J+K, A=F+G+L
                  that wraps around               F=B-R+H+L

[other equation]   [more long text]      A+F+H [<- only this equation]

The specific format I'm looking to make is that of the one in column 3, where the 3rd equation is directly under the 2nd equation.

However only in certain rows like row 1 and 2. Row 3 just has a single equation, that doesn't need to take that format.

I'm doing this because certain lines are too long and go off the end of the page. And I to want to split it up, column 1 is just 1 long equation which I can't split up. Column 2 is just text, and I've found a way to wrap it around quiet nicely. Column 3 however consists of either 1, 2, or 3 different equations, and I want to bring an equation down to the next line, but in the format I need, equation 3 below 2.

I've tried using the format of column 2, in column 3, messes up all my equations in the other rows of the table.

Any help would be appreciated, my code and a picture of how my current pdf looks, is below: What my current pdf looks like

\documentclass[10pt,a4paper]{article}
\setlength{\abovecaptionskip}{5mm}
\usepackage{array}
\newcolumntype{L}{>{\centering}m{5cm}}
\newcolumntype{j}m{5cm}}
\setlength{\extrarowheight}{2.5mm}
\usepackage{amsmath}
\usepackage{multicol}
\usepackage{float}
\usepackage{longtable}

~ all preamble ~

\begin{Document}

...

...

\renewcommand{\arraystretch}{1.7}

\begin{longtable}{ l L l }

$\overline{X} \cdotp Y \cdotp Z + \overline{X \cdotp \overline{Y} \cdotp  \overline{Z} + X \cdotp Y \cdotp Z} $ & 

Use De Morgan's law [OR to AND] & 

$ \overline{A+B} = \overline{A} \cdotp \overline{B}, $  $ \quad A = X \cdotp \overline{Y} \cdotp \overline{Z}, $ $\quad B = X \cdotp Y \cdotp Z $ \\\

...

more similiar rows

...

\end{longtable}

\end{document}

Best Answer

enter image description here

With math environments from amsmath package, like multline, you can set multi line equations:

\documentclass[10pt,a4paper]{article}
\usepackage[margin=25mm]{geometry}% <-- added
\usepackage{amsmath}
\usepackage{array,longtable}
\newcolumntype{L}{>{\centering}m{5cm}}
\newcolumntype{j}{m{5cm}}% <-- corrected, it is not used in MWE
\setlength{\extrarowheight}{2.5mm}


\begin{document}

{\renewcommand{\arraystretch}{1.7}
\begin{longtable}{ >{$}l<{$} % <-- put column cells in math mode
                    L 
                   >{$}l<{$}% <-- put column cells in math mode 
                   }
%
\overline{X}\cdotp Y\cdotp Z + 
\overline{X\cdotp\overline{Y}\cdotp\overline{Z} + X \cdotp Y\cdotp Z} 
    &
Use De Morgan's law\newline [OR to AND] 
    &
\begin{aligned}[t]% <-- amsmath environment, which enable 
                  % to write muti line equations,
                  % option [t] align environment baseline to top
\overline{A+B} = \overline{A}\cdotp\overline{B}, 
        &\quad A = X \cdotp \overline{Y} \cdotp \overline{Z},\\
        &\quad B = X \cdotp Y \cdotp Z 
\end{aligned}               \\
%
\overline{X}\cdotp Y\cdotp Z +
\overline{X\cdotp\overline{Y}\cdotp\overline{Z} + X\cdotp Y\cdotp Z}
    &
Use De Morgan's law\newline [OR to AND]
    &
\overline{A+B} = \overline{A}\cdotp\overline{B}
%
\end{longtable}
}
\end{document}

I assume, that your table in real document will occupy more pages, so I left logtable for table environment. If it will be only on one page, than you should consider to use tabular instead longtable.

Related Question