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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to latex and all of my matrices seem to be created on new lines, I can't seem to put them side by side. Here is what I am doing to make a matrix (with the 2d identity matrix as an example):

\[ \left( \begin{array}{cc}
1 & 0 \\
0 & 1
\end{array} \right) \]

Am I making it wrong? How can I place a second matrix directly beside this, as you would when doing matrix mathematics? Thanks

share|improve this question
up vote 17 down vote accepted

Don't enclose each array with \[ ... \]; instead, put all the arrays that you want together within one set of delimeters. Like this:

\[ \left( \begin{array}{cc}
1 & 0 \\
0 & 1
\end{array} \right)
%
\left( \begin{array}{cc}
1 & 0 \\
0 & 1
\end{array} \right)
\]

You should read the mathmode documentation. It should be part of your TeX Distribution, and has lots of examples to follow.

share|improve this answer
    
This makes sense. However, does this still handle things like [Matrix][vector] = [vector] all one one line? – user3231 Jan 29 '11 at 20:49
    
@bbel Sure. As long as they will fit on the same line, you can just put them one after another like this (no blank lines in between which is why I separated the two matrices in my example with a % (comment character)). – Alan Munn Jan 29 '11 at 20:52

This is slightly tangential, but you might find it convenient to use the pmatrix environment (defined in amsmath.sty)

\[
\begin{pmatrix}
  1 & 0 \\ 0 & e^{i\pi/k}
\end{pmatrix}
\begin{pmatrix}
  u \\ v
\end{pmatrix}
=
\begin{pmatrix}
  u \\ -v
\end{pmatrix}
\]
share|improve this answer

like this

\[ \left( \begin{array}{cc}
1 & 0 \\
0 & 1
\end{array} \right) \times \left( \begin{array}{cc}
1 & 0 \\
0 & 1
\end{array} \right) =\left( \begin{array}{cc}
1 & 0 \\
0 & 1
\end{array} \right)\] 

You need to place the matrices inside the math environment

share|improve this answer
    
Inside the math environment by surrounding them with the dollar sign operator? Because that gives me errors in itself.. – user3231 Jan 29 '11 at 20:45
1  
\[..\] is a math environment When you use this environment the math expression is written on a single line. Like Alan, I think you should read the mathmode.pdf documentation from Herbert Voss. – Alain Matthes Jan 29 '11 at 21:18

Your Answer

 
discard

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