1

I'm trying to align an equation block with eight terms in the following layout:

A....... B..............
C.....   D....    E......
F......  G......  H...

I've tried just leaving out the third column in the first line, but that pushes the third column far right:

\begin{gather}
\begin{aligned}
&\text{A.......} &&\text{B..............} \\
&\text{C.....}   &&\text{D....}    &&\text{E......} \\
&\text{F......}  &&\text{G......}  &&\text{H...}
\end{aligned}
\end{gather}

latex aligned skip column

If this were a table, I would merge the second and third cells of the first row using \multicolumn.

How can I position E and H before the end of B?

3

Depending on the width of B..., you can set it inside a \mathrlap:

enter image description here

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{gather}
  \begin{aligned}
    &\text{A.......} && \mathrlap{\text{B..............}} \\
    &\text{C.....}   && \text{D....}    && \text{E......} \\
    &\text{F......}  && \text{G......}  && \text{H...}
  \end{aligned}
\end{gather}

\end{document}
| improve this answer | |
  • Cool, thanks! This works because B is always longer than either D or G in my case. – danijar Jan 6 at 2:46
2

Why not use aray? With it is siple (as you noted in question):

\documentclass{article}
\usepackage{amsmath}
\usepackage{makecell}

\begin{document}
    \begin{equation}
    \begin{equation}
    \setcellgapes{3pt}
    \makegapedcells\bigotimes
\begin{array}{lll}
\gamma^2 = \alpha^2 + \beta^2  
                &\multicolumn{2}{l}{\displaystyle
                \sin{x}= \sum_{i=0}^{\infty}\frac{(-1)^i}{(2i+1)!}x^{2i+1}
                                    }                       \\
\text{C.....}   &\text{D....}    &\text{E......}            \\
\text{F......}  &\text{G......}  &\text{H...}
\end{array}
    \end{equation}
\end{document}

enter image description here

| improve this answer | |
  • Is this recommended for equations? Would the spacing be correct? I should have said that the words in my question are just placeholders for terms of mathematical equations. – danijar Jan 6 at 2:43
  • @danijar, as you see, in the all rows are math term (\alpha, \beta, \text{C ...}` etc), so, you can put there any equation instead them. To convince you, I wrote two equation in the first row i of the arrax. Note, math term inside them are in-line math expresions. See edited example!. – Zarko Jan 6 at 3:13
  • Good to know, thanks. Would you recommend this over the solution using \mathrlap? It seems like tables come in handy for more complex situations but for now \mathrlap is a simpler solution. – danijar Jan 6 at 3:58
  • Why you would use \mathrlap? In showed example I don't see anything for fine tuning of math expression (for example sum) with it. – Zarko Jan 6 at 7:54
  • 1
    @danijar, now I see, where you like to use mathrlap (instead of the /standard/ multicolumn) This use is (according to my opinion) against to standard syntax for table settings. I do not recommend it. I suggest you to ask new question: What is correct: use mathrlap or multicolumn for multi column long equations`. With some luck you will get competent answers from LaTeX gurus :-) – Zarko Jan 6 at 14:02

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.