How to have matrices side by side in latex?
up vote
18
down vote
favorite
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
matrices
add a comment |
up vote
18
down vote
favorite
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
matrices
add a comment |
up vote
18
down vote
favorite
up vote
18
down vote
favorite
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
matrices
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
matrices
matrices
edited Jul 15 '17 at 13:48
David Carlisle
480k3811121848
480k3811121848
asked Jan 29 '11 at 20:37
user3231
add a comment |
add a comment |
5 Answers
5
active
oldest
votes
up vote
22
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.
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
add a comment |
up vote
9
down vote
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^{ipi/k}
end{pmatrix}
begin{pmatrix}
u \ v
end{pmatrix}
=
begin{pmatrix}
u \ -v
end{pmatrix}
]
add a comment |
up vote
3
down vote
The idea is to enclose both matrices in one block i.e. [ ] see this example
[
begin{bmatrix}
a & b \
c & d
end{bmatrix}
=
begin{bmatrix}
8 & 1 \
7 & 6
end{bmatrix}
]
It will be something like:

This is already covered by the other answer(s).
– Werner
Oct 19 '16 at 4:27
add a comment |
up vote
3
down vote
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
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
add a comment |
up vote
0
down vote
I was confused by the answers and the syntax so I'll share mine and include an image. I'm using begin{equation} which is arguably less convenient but also more verbose for beginners (like myself) than using the [ syntax.
To be clear, what is causing the matrices to be on separate lines is the blank line between the min the code. If you fill it with the placeholder % or remove the line completely it will render like the attached picture. (Thanks to Teepeemm for clarifying what % is!)
begin{equation}
begin{bmatrix}
C_1 & C_2 & C_3 & C_4
end{bmatrix}
%
begin{bmatrix}
z_1 \
z_2 \
z_3 \
z_4 \
end{bmatrix}
end{equation}

The%in the middle is a place holder that doesn't need to be there. TeX doesn't allow have a blank line, so the%gives a line that isn't blank but doesn't have any consequences. Also, the[syntax is equivalent tobegin{equation*}.begin{equation}(without the*) will number the equation.
– Teepeemm
Dec 5 at 15:29
Thanks for your clarification on the%. That explains why my matrices didn't line up side-by-side when adding a space between them. They do however line up correctly without the%and without an empty line between them. Thanks for clearing that up for me! :) I'll modify my answer.
– Emanuel Lindström
Dec 6 at 17:30
add a comment |
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
22
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.
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
add a comment |
up vote
22
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.
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
add a comment |
up vote
22
down vote
accepted
up vote
22
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.
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.
edited Jul 15 '17 at 13:48
David Carlisle
480k3811121848
480k3811121848
answered Jan 29 '11 at 20:46
Alan Munn
158k27423697
158k27423697
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
add a comment |
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 makes sense. However, does this still handle things like [Matrix][vector] = [vector] all one one line?
– user3231
Jan 29 '11 at 20:49
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
@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
add a comment |
up vote
9
down vote
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^{ipi/k}
end{pmatrix}
begin{pmatrix}
u \ v
end{pmatrix}
=
begin{pmatrix}
u \ -v
end{pmatrix}
]
add a comment |
up vote
9
down vote
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^{ipi/k}
end{pmatrix}
begin{pmatrix}
u \ v
end{pmatrix}
=
begin{pmatrix}
u \ -v
end{pmatrix}
]
add a comment |
up vote
9
down vote
up vote
9
down vote
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^{ipi/k}
end{pmatrix}
begin{pmatrix}
u \ v
end{pmatrix}
=
begin{pmatrix}
u \ -v
end{pmatrix}
]
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^{ipi/k}
end{pmatrix}
begin{pmatrix}
u \ v
end{pmatrix}
=
begin{pmatrix}
u \ -v
end{pmatrix}
]
edited Feb 1 '11 at 23:05
answered Jan 30 '11 at 12:23
Punya
39827
39827
add a comment |
add a comment |
up vote
3
down vote
The idea is to enclose both matrices in one block i.e. [ ] see this example
[
begin{bmatrix}
a & b \
c & d
end{bmatrix}
=
begin{bmatrix}
8 & 1 \
7 & 6
end{bmatrix}
]
It will be something like:

This is already covered by the other answer(s).
– Werner
Oct 19 '16 at 4:27
add a comment |
up vote
3
down vote
The idea is to enclose both matrices in one block i.e. [ ] see this example
[
begin{bmatrix}
a & b \
c & d
end{bmatrix}
=
begin{bmatrix}
8 & 1 \
7 & 6
end{bmatrix}
]
It will be something like:

This is already covered by the other answer(s).
– Werner
Oct 19 '16 at 4:27
add a comment |
up vote
3
down vote
up vote
3
down vote
The idea is to enclose both matrices in one block i.e. [ ] see this example
[
begin{bmatrix}
a & b \
c & d
end{bmatrix}
=
begin{bmatrix}
8 & 1 \
7 & 6
end{bmatrix}
]
It will be something like:

The idea is to enclose both matrices in one block i.e. [ ] see this example
[
begin{bmatrix}
a & b \
c & d
end{bmatrix}
=
begin{bmatrix}
8 & 1 \
7 & 6
end{bmatrix}
]
It will be something like:

answered Oct 19 '16 at 3:42
iamaziz
25125
25125
This is already covered by the other answer(s).
– Werner
Oct 19 '16 at 4:27
add a comment |
This is already covered by the other answer(s).
– Werner
Oct 19 '16 at 4:27
This is already covered by the other answer(s).
– Werner
Oct 19 '16 at 4:27
This is already covered by the other answer(s).
– Werner
Oct 19 '16 at 4:27
add a comment |
up vote
3
down vote
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
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
add a comment |
up vote
3
down vote
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
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
add a comment |
up vote
3
down vote
up vote
3
down vote
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
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
edited Jul 15 '17 at 13:48
David Carlisle
480k3811121848
480k3811121848
answered Jan 29 '11 at 20:43
Alain Matthes
72.3k7158292
72.3k7158292
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
add a comment |
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
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
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
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
[..] 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
add a comment |
up vote
0
down vote
I was confused by the answers and the syntax so I'll share mine and include an image. I'm using begin{equation} which is arguably less convenient but also more verbose for beginners (like myself) than using the [ syntax.
To be clear, what is causing the matrices to be on separate lines is the blank line between the min the code. If you fill it with the placeholder % or remove the line completely it will render like the attached picture. (Thanks to Teepeemm for clarifying what % is!)
begin{equation}
begin{bmatrix}
C_1 & C_2 & C_3 & C_4
end{bmatrix}
%
begin{bmatrix}
z_1 \
z_2 \
z_3 \
z_4 \
end{bmatrix}
end{equation}

The%in the middle is a place holder that doesn't need to be there. TeX doesn't allow have a blank line, so the%gives a line that isn't blank but doesn't have any consequences. Also, the[syntax is equivalent tobegin{equation*}.begin{equation}(without the*) will number the equation.
– Teepeemm
Dec 5 at 15:29
Thanks for your clarification on the%. That explains why my matrices didn't line up side-by-side when adding a space between them. They do however line up correctly without the%and without an empty line between them. Thanks for clearing that up for me! :) I'll modify my answer.
– Emanuel Lindström
Dec 6 at 17:30
add a comment |
up vote
0
down vote
I was confused by the answers and the syntax so I'll share mine and include an image. I'm using begin{equation} which is arguably less convenient but also more verbose for beginners (like myself) than using the [ syntax.
To be clear, what is causing the matrices to be on separate lines is the blank line between the min the code. If you fill it with the placeholder % or remove the line completely it will render like the attached picture. (Thanks to Teepeemm for clarifying what % is!)
begin{equation}
begin{bmatrix}
C_1 & C_2 & C_3 & C_4
end{bmatrix}
%
begin{bmatrix}
z_1 \
z_2 \
z_3 \
z_4 \
end{bmatrix}
end{equation}

The%in the middle is a place holder that doesn't need to be there. TeX doesn't allow have a blank line, so the%gives a line that isn't blank but doesn't have any consequences. Also, the[syntax is equivalent tobegin{equation*}.begin{equation}(without the*) will number the equation.
– Teepeemm
Dec 5 at 15:29
Thanks for your clarification on the%. That explains why my matrices didn't line up side-by-side when adding a space between them. They do however line up correctly without the%and without an empty line between them. Thanks for clearing that up for me! :) I'll modify my answer.
– Emanuel Lindström
Dec 6 at 17:30
add a comment |
up vote
0
down vote
up vote
0
down vote
I was confused by the answers and the syntax so I'll share mine and include an image. I'm using begin{equation} which is arguably less convenient but also more verbose for beginners (like myself) than using the [ syntax.
To be clear, what is causing the matrices to be on separate lines is the blank line between the min the code. If you fill it with the placeholder % or remove the line completely it will render like the attached picture. (Thanks to Teepeemm for clarifying what % is!)
begin{equation}
begin{bmatrix}
C_1 & C_2 & C_3 & C_4
end{bmatrix}
%
begin{bmatrix}
z_1 \
z_2 \
z_3 \
z_4 \
end{bmatrix}
end{equation}

I was confused by the answers and the syntax so I'll share mine and include an image. I'm using begin{equation} which is arguably less convenient but also more verbose for beginners (like myself) than using the [ syntax.
To be clear, what is causing the matrices to be on separate lines is the blank line between the min the code. If you fill it with the placeholder % or remove the line completely it will render like the attached picture. (Thanks to Teepeemm for clarifying what % is!)
begin{equation}
begin{bmatrix}
C_1 & C_2 & C_3 & C_4
end{bmatrix}
%
begin{bmatrix}
z_1 \
z_2 \
z_3 \
z_4 \
end{bmatrix}
end{equation}

edited Dec 6 at 17:34
answered Dec 5 at 14:29
Emanuel Lindström
11
11
The%in the middle is a place holder that doesn't need to be there. TeX doesn't allow have a blank line, so the%gives a line that isn't blank but doesn't have any consequences. Also, the[syntax is equivalent tobegin{equation*}.begin{equation}(without the*) will number the equation.
– Teepeemm
Dec 5 at 15:29
Thanks for your clarification on the%. That explains why my matrices didn't line up side-by-side when adding a space between them. They do however line up correctly without the%and without an empty line between them. Thanks for clearing that up for me! :) I'll modify my answer.
– Emanuel Lindström
Dec 6 at 17:30
add a comment |
The%in the middle is a place holder that doesn't need to be there. TeX doesn't allow have a blank line, so the%gives a line that isn't blank but doesn't have any consequences. Also, the[syntax is equivalent tobegin{equation*}.begin{equation}(without the*) will number the equation.
– Teepeemm
Dec 5 at 15:29
Thanks for your clarification on the%. That explains why my matrices didn't line up side-by-side when adding a space between them. They do however line up correctly without the%and without an empty line between them. Thanks for clearing that up for me! :) I'll modify my answer.
– Emanuel Lindström
Dec 6 at 17:30
The
% in the middle is a place holder that doesn't need to be there. TeX doesn't allow have a blank line, so the % gives a line that isn't blank but doesn't have any consequences. Also, the [ syntax is equivalent to begin{equation*}. begin{equation} (without the *) will number the equation.– Teepeemm
Dec 5 at 15:29
The
% in the middle is a place holder that doesn't need to be there. TeX doesn't allow have a blank line, so the % gives a line that isn't blank but doesn't have any consequences. Also, the [ syntax is equivalent to begin{equation*}. begin{equation} (without the *) will number the equation.– Teepeemm
Dec 5 at 15:29
Thanks for your clarification on the
%. That explains why my matrices didn't line up side-by-side when adding a space between them. They do however line up correctly without the % and without an empty line between them. Thanks for clearing that up for me! :) I'll modify my answer.– Emanuel Lindström
Dec 6 at 17:30
Thanks for your clarification on the
%. That explains why my matrices didn't line up side-by-side when adding a space between them. They do however line up correctly without the % and without an empty line between them. Thanks for clearing that up for me! :) I'll modify my answer.– Emanuel Lindström
Dec 6 at 17:30
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f9901%2fhow-to-have-matrices-side-by-side-in-latex%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown