Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

merge columns in align environment

1,700 views
Skip to first unread message

pkg

unread,
May 10, 2011, 6:22:15 AM5/10/11
to
Dear LaTeX users!

does the align environment allow to merge columns (not all over of
course but only in certain lines)?

Thanks a lot for your help!

Regards

pkg

GL

unread,
May 10, 2011, 6:58:11 AM5/10/11
to

Something like that:

\halign{\tabskip0pt $#$\;&$#$\tabskip26pt &&\tabskip0pt
$#$\;&$#$\tabskip26pt \cr
\alpha &=\beta & \gamma &= \delta & \epsilon &=\zeta & \eta &=
\theta \cr
\omit\span\omit\span\omit\span\omit\span\omit\span \alpha = \beta &
\eta &=\theta \cr
}


I'm not sure ams provides that...

pkg

unread,
May 10, 2011, 9:07:21 AM5/10/11
to

Thanks!

> I'm not sure ams provides that...

Yes, would be fine to have something like \multicolumn ...

pkg

Lars Madsen

unread,
May 10, 2011, 9:13:28 AM5/10/11
to

what for? I do not really see the need or use of this

/daleif


--

/daleif (remove RTFSIGNATURE from email address)

Memoir and mh bundle maintainer
LaTeX FAQ: http://www.tex.ac.uk/faq
LaTeX book: http://www.imf.au.dk/system/latex/bog/ (in Danish)
Remember to post minimal examples, see URL below
http://www.minimalbeispiel.de/mini-en.html

pkg

unread,
May 10, 2011, 11:08:40 AM5/10/11
to
> what for? I do not really see the need or use of this

Suppose you have something like this:

\begin{align}
a & = b && [\text{by Lemma 1}]\\
& = c && [\text{by Lemma 2}]\\
& = d && [\text{by Lemma 3}]\\
& = eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee .
\end{align}

You would then like the explanations in brackets to be aligned.
Without the last line this can be achieved by inserting &&. But if the
very long last line is added, everything behind && skips out of the
range of \textwidth. I admit that this is kind of a peculiar situation
but nevertheless it occurs from time to time.

Regards

pkg

GL

unread,
May 10, 2011, 11:42:56 AM5/10/11
to
Le 10/05/2011 17:08, pkg a écrit :
>> what for? I do not really see the need or use of this
>
> Suppose you have something like this:
>
> \begin{align}
> a& = b&& [\text{by Lemma 1}]\\
> & = c&& [\text{by Lemma 2}]\\
> & = d&& [\text{by Lemma 3}]\\

> & = eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee .
> \end{align}

align is actually not a tabular like array (I don't speak about tabu
ouf !)

align is a AMS-formatted \halign. You can use the \halign tools:

\begin{align}
a & = b && [\text{by Lemma 1}]\\
& = c && [\text{by Lemma 2}]\\
& = d && [\text{by Lemma 3}]\\
&= eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

\span\omit\span\omit
\end{align}


>
> You would then like the explanations in brackets to be aligned.

> Without the last line this can be achieved by inserting&&. But if the
> very long last line is added, everything behind&& skips out of the

GL

unread,
May 10, 2011, 11:46:01 AM5/10/11
to
Le 10/05/2011 17:42, GL a écrit :
> Le 10/05/2011 17:08, pkg a écrit :
>>> what for? I do not really see the need or use of this
>>
>> Suppose you have something like this:
>>
>> \begin{align}
>> a& = b&& [\text{by Lemma 1}]\\
>> & = c&& [\text{by Lemma 2}]\\
>> & = d&& [\text{by Lemma 3}]\\
>> & = eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee .
>> \end{align}
>
> align is actually not a tabular like array (I don't speak about tabu
> ouf !)
>
> align is a AMS-formatted \halign. You can use the \halign tools:
>
> \begin{align}
> a & = b && [\text{by Lemma 1}]\\
> & = c && [\text{by Lemma 2}]\\
> & = d && [\text{by Lemma 3}]\\
> &= eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
> \span\omit\span\omit
> \end{align}

Well after all, \omit is even not necessary. I put it here because the
"LaTeX line" is so strong that it hides TeX...

\begin{align}
a & = b && [\text{by Lemma 1}]\\
& = c && [\text{by Lemma 2}]\\
& = d && [\text{by Lemma 3}]\\

&= eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee \span\span
\end{align}

does it well .

pkg

unread,
May 10, 2011, 12:13:47 PM5/10/11
to
Great! That's exactly what I was looking for!! Thanks a lot.

pkg

Lars Madsen

unread,
May 11, 2011, 4:54:02 AM5/11/11
to

Interesting, I've never dared working with \halign, so I do not know
about its inner workings

how many \span's are needed in a general situation?

GL

unread,
May 11, 2011, 5:12:11 AM5/11/11
to

\span spans the current column with the next one. Here "eeeeeee"
extends on three columns: \span\span spans the first column with
the following two.

I've not studied all in details but \omit\span eeee \span and
\omit\span\omit\span eeee

and \omit\span\span eeeee

would not lead to the same alignments. I've thought about using
such a feature in tabu but it requires more knowledge ;-)

The idea behind was to provide a kind of \multicolumn that does
not \omit the column preamble: vertical leaders, alignments etc.
can be kept. But a lot of new problems arise:
. which spanned column preamble should be used ?
The first ? The last ? one in the middle ?
Is it possible to provide a simple interface ? difficult...
. if the used preamble (not omitted) is p{4cm} such a
"\multicolumn" will be typeset in a parbox whose width
is obviously not interesting. Vertical rules will be at
the wrong place unless a glue is inserted on purpose...

Finally, I came to the conclusion that this was not designed for
a tabular. A tabular uses \halign for alignments but cannot be
considered to be a kind of "\halign" environment.

Yours sincerely.

Lars Madsen

unread,
May 11, 2011, 5:15:30 AM5/11/11
to

it might be an useful addition to mathtools, we already have several odd
little macros in it. One would just need a good interface for it and a
good explanation

0 new messages