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.

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?

share|improve this question

1 Answer 1

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.

share|improve this answer
    
Perfect: just another thing. Matrix is center aligned by default. How can I align it left? –  LatexNewbie Jul 29 '12 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 '12 at 13:39

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.