3

I have a matrix and I want to show some lines of text floating right to the matrix. The problem is that the following code shows two lines of text without executing \\ break-line.

\[ M = \left( \begin{array}{cccc}
a & b & c & d \\
1 & 2 & 3 & 4\\
a & b & c & d\\
1 & 2 & 3 & 4 \end{array} \right)\ Something  \\ Something
] 

How can I fix it?

1 Answer 1

2

Depending on what it is you want to write next to the matrix, you can always stack it in a tabular:

enter image description here

\documentclass{article}
\begin{document}
\[
  M = \left( \begin{array}{cccc}
    a & b & c & d \\
    1 & 2 & 3 & 4\\
    a & b & c & d\\
    1 & 2 & 3 & 4
  \end{array} \right) \qquad
  \begin{tabular}{@{}l}
    First row \\ Row number 2 \\ Third row \\ Last or fourth row.
  \end{tabular}
\]
\end{document}

Creating matrices is also somewhat automated using other constructions. See Where is the \matrix command? For example, your matrix could be created using a pmatrix environment.

2
  • Perfect: just another thing. Matrix is center aligned by default. How can I align it left? Jul 29, 2012 at 13:36
  • @LatexNewbie: If you put your array inside \[...\] it will be centre aligned. If you don't want that, use $...$. If you're referring to the columns of the matrix, then you can simply change your column alignment specification from cccc to llll for left-aligned columns.
    – Werner
    Jul 29, 2012 at 13:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .