braces spanning few rows or columns of a matrix in latex
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
I am trying to put braces on matrix that cover just few rows or columns.
I have come kinda close for the columns but no idea for the rows.
This is the example I have been working on:
documentclassminimal
usepackageamsmath
begindocument
beginequation*
A = beginarrayc@!!!l
left( beginarray[c]ccc
a1 & cdots & aN\
b1 & cdots & bN\
vdots & & vdots\
z1 & cdots & zN \
endarray right)
&
beginarray[c]ll
left. beginarrayc vphantom1cm \ vphantom2*vdots
\ vphantom1cm endarray right} & text$n_1$ times \
endarray
endarray
endequation*
enddocument
which produces this:
Does anyone have any idea?
matrices braces
add a comment |Â
up vote
4
down vote
favorite
I am trying to put braces on matrix that cover just few rows or columns.
I have come kinda close for the columns but no idea for the rows.
This is the example I have been working on:
documentclassminimal
usepackageamsmath
begindocument
beginequation*
A = beginarrayc@!!!l
left( beginarray[c]ccc
a1 & cdots & aN\
b1 & cdots & bN\
vdots & & vdots\
z1 & cdots & zN \
endarray right)
&
beginarray[c]ll
left. beginarrayc vphantom1cm \ vphantom2*vdots
\ vphantom1cm endarray right} & text$n_1$ times \
endarray
endarray
endequation*
enddocument
which produces this:
Does anyone have any idea?
matrices braces
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I am trying to put braces on matrix that cover just few rows or columns.
I have come kinda close for the columns but no idea for the rows.
This is the example I have been working on:
documentclassminimal
usepackageamsmath
begindocument
beginequation*
A = beginarrayc@!!!l
left( beginarray[c]ccc
a1 & cdots & aN\
b1 & cdots & bN\
vdots & & vdots\
z1 & cdots & zN \
endarray right)
&
beginarray[c]ll
left. beginarrayc vphantom1cm \ vphantom2*vdots
\ vphantom1cm endarray right} & text$n_1$ times \
endarray
endarray
endequation*
enddocument
which produces this:
Does anyone have any idea?
matrices braces
I am trying to put braces on matrix that cover just few rows or columns.
I have come kinda close for the columns but no idea for the rows.
This is the example I have been working on:
documentclassminimal
usepackageamsmath
begindocument
beginequation*
A = beginarrayc@!!!l
left( beginarray[c]ccc
a1 & cdots & aN\
b1 & cdots & bN\
vdots & & vdots\
z1 & cdots & zN \
endarray right)
&
beginarray[c]ll
left. beginarrayc vphantom1cm \ vphantom2*vdots
\ vphantom1cm endarray right} & text$n_1$ times \
endarray
endarray
endequation*
enddocument
which produces this:
Does anyone have any idea?
matrices braces
matrices braces
edited Aug 14 at 16:59
asked Aug 11 at 12:50
Fabio
678
678
add a comment |Â
add a comment |Â
4 Answers
4
active
oldest
votes
up vote
4
down vote
accepted
If you want to span only some rows, you can use nicematrix
which will put a Tikz node behind each cell of the matrix and then use the commands of Tikz to draw the brace and its label.
documentclassminimal
usepackagenicematrix
NiceMatrixOptionstransparent
usetikzlibrarydecorations.pathreplacing
begindocument
beginequation*
A = beginpmatrix
[code-after= begintikzpicture
draw [decorate,decoration = brace]
([xshift=3mm]2-4.north east) to node [auto = left] $n_1$ times
([xshift=3mm]4-4.south east) ;
endtikzpicture
]
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpmatrix
endequation*
enddocument
Yes! nicematrix is definitely the way to go. However I couldn't compile your code, could you revisit it?.
â Fabio
Aug 14 at 16:55
add a comment |Â
up vote
4
down vote
If you want to span all rows of a matrix, you have the rcases
environment from mathtools
(an extension of amsmath
), which also simplifies the code for a matrix, with its pmatrix
environment. I added some improvements, as I think the matrix looks nicer with 4 columns:
documentclassminimal
usepackagemathtools
begindocument
beginequation*
beginrcasesdisplaystyle
A = beginpmatrix
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpmatrix
endrcases
text$n_1$ times
endequation*
enddocument
add a comment |Â
up vote
0
down vote
This is the code that worked out for me.
documentclassminimal
usepackagenicematrix
NiceMatrixOptionstransparent
usetikzlibrarydecorations.pathreplacing
begindocument
beginequation*
A=beginpNiceMatrix[name=matrix]
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpNiceMatrix
tikz[remember picture,overlay]
draw[decoration=brace,decorate,thick] ([xshift=3mm]matrix-2-4.north east) -- node[right=6pt] $n_1$ times ([xshift=3mm]matrix-4-4.south east);
endequation*
enddocument
I can compile your code but I can also compile the code of my answer. What is the error messsage you get? If you want, you can send me the log file. My email : fpantigny@wanadoo.fr
â F. Pantigny
Aug 14 at 18:25
The error is "Package pgf Error: No shape named 2-4 is known". and the same for 4-4. I'll send you the log file.
â Fabio
Aug 17 at 22:10
add a comment |Â
up vote
0
down vote
You can construct a zero-width array
next to your matrix containing elements that match the height of the matrix rows. This way you can place a right}
where needed:
documentclassarticle
usepackageamsmath
begindocument
[
A = beginpmatrix
a_1 & cdots & a_N \
b_1 & cdots & b_N \
vdots & & vdots \
z_1 & cdots & z_N \
endpmatrix
setlengtharraycolsep0pt % Avoid any column space in arrays that follow
beginarray c
vphantoma_N \ % First row
left.kern-nulldelimiterspace
vphantombeginarray c
b_N \ % Second row
vdots \ % Third row
z_N % Fourth/last row
endarray
right}text$n_1$ times
endarray
]
enddocument
add a comment |Â
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
If you want to span only some rows, you can use nicematrix
which will put a Tikz node behind each cell of the matrix and then use the commands of Tikz to draw the brace and its label.
documentclassminimal
usepackagenicematrix
NiceMatrixOptionstransparent
usetikzlibrarydecorations.pathreplacing
begindocument
beginequation*
A = beginpmatrix
[code-after= begintikzpicture
draw [decorate,decoration = brace]
([xshift=3mm]2-4.north east) to node [auto = left] $n_1$ times
([xshift=3mm]4-4.south east) ;
endtikzpicture
]
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpmatrix
endequation*
enddocument
Yes! nicematrix is definitely the way to go. However I couldn't compile your code, could you revisit it?.
â Fabio
Aug 14 at 16:55
add a comment |Â
up vote
4
down vote
accepted
If you want to span only some rows, you can use nicematrix
which will put a Tikz node behind each cell of the matrix and then use the commands of Tikz to draw the brace and its label.
documentclassminimal
usepackagenicematrix
NiceMatrixOptionstransparent
usetikzlibrarydecorations.pathreplacing
begindocument
beginequation*
A = beginpmatrix
[code-after= begintikzpicture
draw [decorate,decoration = brace]
([xshift=3mm]2-4.north east) to node [auto = left] $n_1$ times
([xshift=3mm]4-4.south east) ;
endtikzpicture
]
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpmatrix
endequation*
enddocument
Yes! nicematrix is definitely the way to go. However I couldn't compile your code, could you revisit it?.
â Fabio
Aug 14 at 16:55
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
If you want to span only some rows, you can use nicematrix
which will put a Tikz node behind each cell of the matrix and then use the commands of Tikz to draw the brace and its label.
documentclassminimal
usepackagenicematrix
NiceMatrixOptionstransparent
usetikzlibrarydecorations.pathreplacing
begindocument
beginequation*
A = beginpmatrix
[code-after= begintikzpicture
draw [decorate,decoration = brace]
([xshift=3mm]2-4.north east) to node [auto = left] $n_1$ times
([xshift=3mm]4-4.south east) ;
endtikzpicture
]
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpmatrix
endequation*
enddocument
If you want to span only some rows, you can use nicematrix
which will put a Tikz node behind each cell of the matrix and then use the commands of Tikz to draw the brace and its label.
documentclassminimal
usepackagenicematrix
NiceMatrixOptionstransparent
usetikzlibrarydecorations.pathreplacing
begindocument
beginequation*
A = beginpmatrix
[code-after= begintikzpicture
draw [decorate,decoration = brace]
([xshift=3mm]2-4.north east) to node [auto = left] $n_1$ times
([xshift=3mm]4-4.south east) ;
endtikzpicture
]
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpmatrix
endequation*
enddocument
edited Aug 11 at 18:45
answered Aug 11 at 15:58
F. Pantigny
34518
34518
Yes! nicematrix is definitely the way to go. However I couldn't compile your code, could you revisit it?.
â Fabio
Aug 14 at 16:55
add a comment |Â
Yes! nicematrix is definitely the way to go. However I couldn't compile your code, could you revisit it?.
â Fabio
Aug 14 at 16:55
Yes! nicematrix is definitely the way to go. However I couldn't compile your code, could you revisit it?.
â Fabio
Aug 14 at 16:55
Yes! nicematrix is definitely the way to go. However I couldn't compile your code, could you revisit it?.
â Fabio
Aug 14 at 16:55
add a comment |Â
up vote
4
down vote
If you want to span all rows of a matrix, you have the rcases
environment from mathtools
(an extension of amsmath
), which also simplifies the code for a matrix, with its pmatrix
environment. I added some improvements, as I think the matrix looks nicer with 4 columns:
documentclassminimal
usepackagemathtools
begindocument
beginequation*
beginrcasesdisplaystyle
A = beginpmatrix
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpmatrix
endrcases
text$n_1$ times
endequation*
enddocument
add a comment |Â
up vote
4
down vote
If you want to span all rows of a matrix, you have the rcases
environment from mathtools
(an extension of amsmath
), which also simplifies the code for a matrix, with its pmatrix
environment. I added some improvements, as I think the matrix looks nicer with 4 columns:
documentclassminimal
usepackagemathtools
begindocument
beginequation*
beginrcasesdisplaystyle
A = beginpmatrix
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpmatrix
endrcases
text$n_1$ times
endequation*
enddocument
add a comment |Â
up vote
4
down vote
up vote
4
down vote
If you want to span all rows of a matrix, you have the rcases
environment from mathtools
(an extension of amsmath
), which also simplifies the code for a matrix, with its pmatrix
environment. I added some improvements, as I think the matrix looks nicer with 4 columns:
documentclassminimal
usepackagemathtools
begindocument
beginequation*
beginrcasesdisplaystyle
A = beginpmatrix
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpmatrix
endrcases
text$n_1$ times
endequation*
enddocument
If you want to span all rows of a matrix, you have the rcases
environment from mathtools
(an extension of amsmath
), which also simplifies the code for a matrix, with its pmatrix
environment. I added some improvements, as I think the matrix looks nicer with 4 columns:
documentclassminimal
usepackagemathtools
begindocument
beginequation*
beginrcasesdisplaystyle
A = beginpmatrix
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpmatrix
endrcases
text$n_1$ times
endequation*
enddocument
edited Aug 11 at 19:25
answered Aug 11 at 13:42
Bernard
156k763189
156k763189
add a comment |Â
add a comment |Â
up vote
0
down vote
This is the code that worked out for me.
documentclassminimal
usepackagenicematrix
NiceMatrixOptionstransparent
usetikzlibrarydecorations.pathreplacing
begindocument
beginequation*
A=beginpNiceMatrix[name=matrix]
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpNiceMatrix
tikz[remember picture,overlay]
draw[decoration=brace,decorate,thick] ([xshift=3mm]matrix-2-4.north east) -- node[right=6pt] $n_1$ times ([xshift=3mm]matrix-4-4.south east);
endequation*
enddocument
I can compile your code but I can also compile the code of my answer. What is the error messsage you get? If you want, you can send me the log file. My email : fpantigny@wanadoo.fr
â F. Pantigny
Aug 14 at 18:25
The error is "Package pgf Error: No shape named 2-4 is known". and the same for 4-4. I'll send you the log file.
â Fabio
Aug 17 at 22:10
add a comment |Â
up vote
0
down vote
This is the code that worked out for me.
documentclassminimal
usepackagenicematrix
NiceMatrixOptionstransparent
usetikzlibrarydecorations.pathreplacing
begindocument
beginequation*
A=beginpNiceMatrix[name=matrix]
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpNiceMatrix
tikz[remember picture,overlay]
draw[decoration=brace,decorate,thick] ([xshift=3mm]matrix-2-4.north east) -- node[right=6pt] $n_1$ times ([xshift=3mm]matrix-4-4.south east);
endequation*
enddocument
I can compile your code but I can also compile the code of my answer. What is the error messsage you get? If you want, you can send me the log file. My email : fpantigny@wanadoo.fr
â F. Pantigny
Aug 14 at 18:25
The error is "Package pgf Error: No shape named 2-4 is known". and the same for 4-4. I'll send you the log file.
â Fabio
Aug 17 at 22:10
add a comment |Â
up vote
0
down vote
up vote
0
down vote
This is the code that worked out for me.
documentclassminimal
usepackagenicematrix
NiceMatrixOptionstransparent
usetikzlibrarydecorations.pathreplacing
begindocument
beginequation*
A=beginpNiceMatrix[name=matrix]
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpNiceMatrix
tikz[remember picture,overlay]
draw[decoration=brace,decorate,thick] ([xshift=3mm]matrix-2-4.north east) -- node[right=6pt] $n_1$ times ([xshift=3mm]matrix-4-4.south east);
endequation*
enddocument
This is the code that worked out for me.
documentclassminimal
usepackagenicematrix
NiceMatrixOptionstransparent
usetikzlibrarydecorations.pathreplacing
begindocument
beginequation*
A=beginpNiceMatrix[name=matrix]
a1 &hdotsfor2 & aN\
b1 &hdotsfor2 & bN\
vdots & & & vdots\
z1 & cdots &cdots & zN \
endpNiceMatrix
tikz[remember picture,overlay]
draw[decoration=brace,decorate,thick] ([xshift=3mm]matrix-2-4.north east) -- node[right=6pt] $n_1$ times ([xshift=3mm]matrix-4-4.south east);
endequation*
enddocument
answered Aug 14 at 16:58
Fabio
678
678
I can compile your code but I can also compile the code of my answer. What is the error messsage you get? If you want, you can send me the log file. My email : fpantigny@wanadoo.fr
â F. Pantigny
Aug 14 at 18:25
The error is "Package pgf Error: No shape named 2-4 is known". and the same for 4-4. I'll send you the log file.
â Fabio
Aug 17 at 22:10
add a comment |Â
I can compile your code but I can also compile the code of my answer. What is the error messsage you get? If you want, you can send me the log file. My email : fpantigny@wanadoo.fr
â F. Pantigny
Aug 14 at 18:25
The error is "Package pgf Error: No shape named 2-4 is known". and the same for 4-4. I'll send you the log file.
â Fabio
Aug 17 at 22:10
I can compile your code but I can also compile the code of my answer. What is the error messsage you get? If you want, you can send me the log file. My email : fpantigny@wanadoo.fr
â F. Pantigny
Aug 14 at 18:25
I can compile your code but I can also compile the code of my answer. What is the error messsage you get? If you want, you can send me the log file. My email : fpantigny@wanadoo.fr
â F. Pantigny
Aug 14 at 18:25
The error is "Package pgf Error: No shape named 2-4 is known". and the same for 4-4. I'll send you the log file.
â Fabio
Aug 17 at 22:10
The error is "Package pgf Error: No shape named 2-4 is known". and the same for 4-4. I'll send you the log file.
â Fabio
Aug 17 at 22:10
add a comment |Â
up vote
0
down vote
You can construct a zero-width array
next to your matrix containing elements that match the height of the matrix rows. This way you can place a right}
where needed:
documentclassarticle
usepackageamsmath
begindocument
[
A = beginpmatrix
a_1 & cdots & a_N \
b_1 & cdots & b_N \
vdots & & vdots \
z_1 & cdots & z_N \
endpmatrix
setlengtharraycolsep0pt % Avoid any column space in arrays that follow
beginarray c
vphantoma_N \ % First row
left.kern-nulldelimiterspace
vphantombeginarray c
b_N \ % Second row
vdots \ % Third row
z_N % Fourth/last row
endarray
right}text$n_1$ times
endarray
]
enddocument
add a comment |Â
up vote
0
down vote
You can construct a zero-width array
next to your matrix containing elements that match the height of the matrix rows. This way you can place a right}
where needed:
documentclassarticle
usepackageamsmath
begindocument
[
A = beginpmatrix
a_1 & cdots & a_N \
b_1 & cdots & b_N \
vdots & & vdots \
z_1 & cdots & z_N \
endpmatrix
setlengtharraycolsep0pt % Avoid any column space in arrays that follow
beginarray c
vphantoma_N \ % First row
left.kern-nulldelimiterspace
vphantombeginarray c
b_N \ % Second row
vdots \ % Third row
z_N % Fourth/last row
endarray
right}text$n_1$ times
endarray
]
enddocument
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You can construct a zero-width array
next to your matrix containing elements that match the height of the matrix rows. This way you can place a right}
where needed:
documentclassarticle
usepackageamsmath
begindocument
[
A = beginpmatrix
a_1 & cdots & a_N \
b_1 & cdots & b_N \
vdots & & vdots \
z_1 & cdots & z_N \
endpmatrix
setlengtharraycolsep0pt % Avoid any column space in arrays that follow
beginarray c
vphantoma_N \ % First row
left.kern-nulldelimiterspace
vphantombeginarray c
b_N \ % Second row
vdots \ % Third row
z_N % Fourth/last row
endarray
right}text$n_1$ times
endarray
]
enddocument
You can construct a zero-width array
next to your matrix containing elements that match the height of the matrix rows. This way you can place a right}
where needed:
documentclassarticle
usepackageamsmath
begindocument
[
A = beginpmatrix
a_1 & cdots & a_N \
b_1 & cdots & b_N \
vdots & & vdots \
z_1 & cdots & z_N \
endpmatrix
setlengtharraycolsep0pt % Avoid any column space in arrays that follow
beginarray c
vphantoma_N \ % First row
left.kern-nulldelimiterspace
vphantombeginarray c
b_N \ % Second row
vdots \ % Third row
z_N % Fourth/last row
endarray
right}text$n_1$ times
endarray
]
enddocument
answered Aug 14 at 17:09
Werner
421k589141582
421k589141582
add a comment |Â
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f445636%2fbraces-spanning-few-rows-or-columns-of-a-matrix-in-latex%23new-answer', 'question_page');
);
Post as a guest
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
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
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