Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there a good/correct way of making an align environment with one line spanning multiple columns?

At the moment I'm using a hack like the following, but I feel that it's probably not the best way.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
 L1C1 &= 1234 \,,&     L1C2 &= abcd \,,\\
 L2C1 &= 1234 \,,&     L2C2 &= efgh \,,\\
 L3 &= 1234567890abcdefghijklmnop \ . \hspace{-30cm}
\end{align}    
\end{document}

the result of above code

share|improve this question
1  
another hack is to \rlap the part of the wider lines that would exceed the width of the first column. in the example given, i would, for the last line, put L3 &= 1234567890\rlap{$abcdefghijklmnop \ .$}. most lines of math contain reasonable places where one can break without damage. –  barbara beeton Apr 15 '11 at 12:17
    
@barbara: You should post that as an answer. –  Loop Space Apr 15 '11 at 17:35

2 Answers 2

up vote 4 down vote accepted

this is also a hack, but it will give the desired result.

use \rlap to "hide" the width of the overlong line. for the example given, i would do this for the last line:

L3 &= 1234567890\rlap{$abcdefghijklmnop \ .$}

you might even want to put some extra space after that to get the desired separation; just look at the output to see what's needed.

most lines of math contain reasonable places where one can break without damage.

share|improve this answer
7  
with package mathtools one can write \mathrlap{abcd...} –  Herbert Apr 15 '11 at 17:54
    
I always forget the *lap commands (but for some reason smash stays in my head). @Herbert Thanks for the mathrlap command from mathtools. I think that's the cleanest solution given yet. –  Simon Apr 15 '11 at 23:28

To span you could use \span:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
 L1C1 &= 1234 \,,&     L1C2 &= abcd \,,\\
 L2C1 &= 1234 \,,&     L2C2 &= efgh \,,\\
 L3 &= {}\span\omit$1234567890abcdefghijklmnop$\ .\hidewidth
\end{align}    
\end{document}

It turned out to be a lot more hacky than I initially thought it would be.

share|improve this answer
2  
\span does not have the proper "class" for tex to be able to determine the spacing (see table, texbook, p.170). if you precede \span by {} that would obviate the need for \;. –  barbara beeton Apr 15 '11 at 20:09
    
This changes the position of the equation numbering. Here's a comparison. –  Simon Apr 15 '11 at 23:29
    
@barbara: thanks for the info. –  morbusg Apr 16 '11 at 5:26
    
@Simon: Edited. –  morbusg Apr 16 '11 at 5:34
    
Thanks morbusg! –  Simon Apr 16 '11 at 7:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.