I have a matrix whose entries are quite long and must be broken up across multiple lines. The desired break-points are the + operators separating terms in each matrix element. The following code is illustrative of the problem I face: the + operators in the second line of each matrix element appear as unary rather than binary operators. Can this be changed?

enter image description here

 a + b &  e + f \\
+c + d & +g + h \\[6pt]
 i + j &  m + n \\
+k + l & +o + p \\

I would most prefer if each term was aligned vertically with the corresponding term below it (e.g., a+b in vertical alignment with c+d), with the additional + sign to the left, and properly spaced from the ensuing c (i.e., subjected to the spacing that is accorded to binary operators).

Also, as a means of clarifying that the top two lines and bottom two lines separately constitute single rows, I introduced whitespace between lines 2 and 3 by adding [6pt] after the closing \\ of the second matrix line). Is there a better way to selectively introduce whitespace?

Lastly, is there a more automated way to achieve line-breaking in a matrix environment, compared to my manual separation of long lines across \\ separators? Thanks.


   a + b &    e + f \\
{}+c + d & {}+g + h \\[6pt]
   i + j &    m + n \\
{}+k + l & {}+o + p \\

enter image description here

  • Indeed, right alignment is neater method than using phantoms. Mar 13 '12 at 16:35

To change an operator from unary to binary, put an empty group before it, e.g. {}+c+d. You could use the \phantom command to get the vertical alignment right: \phantom{{}+{}}a+b see section 3.7.1 of the Not so short introduction to LaTeX.

  • Ah, I just came across the phantom operator before you posted this, and it solves the alignment issue. However, I was using \phantom{+} rather than \phantom{{}+} (I wasn't aware of how to change unary to binary operators). Many thanks for both solutions.
    – user001
    Mar 13 '12 at 16:27

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.