How to draw a circle in a matrix like this?
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
I came across matrices like this in a book. Can I create this using pure latex commands or do I need to using something like Photoshop for help?
Update: I've created the equation without circle like this:
documentclass[a4paper,12pt,hidelinks]article
usepackagemathtools
begindocument
titleTitle of the doc
authorme
datetoday
maketitle
sectionExample
beginequation*
beginvmatrix*[c]
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
&& ddots & vdots \
&&& a_nn
endvmatrix* =
beginvmatrix*[c]
a_11 &&& \
a_21 & a_22 && \
vdots & vdots & ddots & \
a_n1 & a_n2 & cdots & a_nn
endvmatrix* =
a_11a_22 dots a_nn
endequation*
enddocument
tikz-pgf pstricks matrices tikz-matrix draw
New contributor
Ogrish Man is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
4
down vote
favorite
I came across matrices like this in a book. Can I create this using pure latex commands or do I need to using something like Photoshop for help?
Update: I've created the equation without circle like this:
documentclass[a4paper,12pt,hidelinks]article
usepackagemathtools
begindocument
titleTitle of the doc
authorme
datetoday
maketitle
sectionExample
beginequation*
beginvmatrix*[c]
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
&& ddots & vdots \
&&& a_nn
endvmatrix* =
beginvmatrix*[c]
a_11 &&& \
a_21 & a_22 && \
vdots & vdots & ddots & \
a_n1 & a_n2 & cdots & a_nn
endvmatrix* =
a_11a_22 dots a_nn
endequation*
enddocument
tikz-pgf pstricks matrices tikz-matrix draw
New contributor
Ogrish Man is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Welcome to TeX.SE! You certainly do not need photoshop for this. Could you please provide us with the code for the matrices without the "circle"?
– marmot
23 hours ago
OK, yes, let me do it and update the question. I just learned latex a few hours ago and this is a good chance to practice :)
– Ogrish Man
23 hours ago
The solution has been written long time ago here.
– Artificial Stupidity
23 hours ago
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I came across matrices like this in a book. Can I create this using pure latex commands or do I need to using something like Photoshop for help?
Update: I've created the equation without circle like this:
documentclass[a4paper,12pt,hidelinks]article
usepackagemathtools
begindocument
titleTitle of the doc
authorme
datetoday
maketitle
sectionExample
beginequation*
beginvmatrix*[c]
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
&& ddots & vdots \
&&& a_nn
endvmatrix* =
beginvmatrix*[c]
a_11 &&& \
a_21 & a_22 && \
vdots & vdots & ddots & \
a_n1 & a_n2 & cdots & a_nn
endvmatrix* =
a_11a_22 dots a_nn
endequation*
enddocument
tikz-pgf pstricks matrices tikz-matrix draw
New contributor
Ogrish Man is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I came across matrices like this in a book. Can I create this using pure latex commands or do I need to using something like Photoshop for help?
Update: I've created the equation without circle like this:
documentclass[a4paper,12pt,hidelinks]article
usepackagemathtools
begindocument
titleTitle of the doc
authorme
datetoday
maketitle
sectionExample
beginequation*
beginvmatrix*[c]
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
&& ddots & vdots \
&&& a_nn
endvmatrix* =
beginvmatrix*[c]
a_11 &&& \
a_21 & a_22 && \
vdots & vdots & ddots & \
a_n1 & a_n2 & cdots & a_nn
endvmatrix* =
a_11a_22 dots a_nn
endequation*
enddocument
tikz-pgf pstricks matrices tikz-matrix draw
tikz-pgf pstricks matrices tikz-matrix draw
New contributor
Ogrish Man is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Ogrish Man is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 22 hours ago
J Leon V.
6,625528
6,625528
New contributor
Ogrish Man is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 23 hours ago
Ogrish Man
1234
1234
New contributor
Ogrish Man is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Ogrish Man is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Ogrish Man is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Welcome to TeX.SE! You certainly do not need photoshop for this. Could you please provide us with the code for the matrices without the "circle"?
– marmot
23 hours ago
OK, yes, let me do it and update the question. I just learned latex a few hours ago and this is a good chance to practice :)
– Ogrish Man
23 hours ago
The solution has been written long time ago here.
– Artificial Stupidity
23 hours ago
add a comment |Â
1
Welcome to TeX.SE! You certainly do not need photoshop for this. Could you please provide us with the code for the matrices without the "circle"?
– marmot
23 hours ago
OK, yes, let me do it and update the question. I just learned latex a few hours ago and this is a good chance to practice :)
– Ogrish Man
23 hours ago
The solution has been written long time ago here.
– Artificial Stupidity
23 hours ago
1
1
Welcome to TeX.SE! You certainly do not need photoshop for this. Could you please provide us with the code for the matrices without the "circle"?
– marmot
23 hours ago
Welcome to TeX.SE! You certainly do not need photoshop for this. Could you please provide us with the code for the matrices without the "circle"?
– marmot
23 hours ago
OK, yes, let me do it and update the question. I just learned latex a few hours ago and this is a good chance to practice :)
– Ogrish Man
23 hours ago
OK, yes, let me do it and update the question. I just learned latex a few hours ago and this is a good chance to practice :)
– Ogrish Man
23 hours ago
The solution has been written long time ago here.
– Artificial Stupidity
23 hours ago
The solution has been written long time ago here.
– Artificial Stupidity
23 hours ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
5
down vote
accepted
Run with xelatex
documentclassarticle
usepackageamsmath
usepackagepstricks
begindocument
[
beginvmatrix
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
psellipse[rot=45](0.5,0)(0.3,0.6) & & ddots & vdots \
& & & a_nn
endvmatrix
=
beginvmatrix
a_11 & & & \
a_21 & a_22 & & psellipse[rot=45](-0.5,0.1)(0.3,0.6) \
vdots & vdots & ddots & \
a_n1 & a_n1 & cdots & a_nn
endvmatrix
= a_11, a_22cdots a_nn
]
enddocument
and the same with package tikz
[
beginvmatrix
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
tikz[overlay]draw (0.5,0) circle [x radius=3mm,y radius=6mm,rotate=45];
& & ddots &
vdots \
& & & a_nn
endvmatrix
=
beginvmatrix
a_11 & & & \
a_21 & a_22 & &
tikz[overlay]draw (-0.5,0.1) circle [x radius=3mm,y radius=6mm,rotate=45]; \
vdots & vdots & ddots & \
a_n1 & a_n1 & cdots & a_nn
endvmatrix
= a_11, a_22cdots a_nn
]
Whyxelatex
? I get the result also with "normal"latex
.
– campa
21 hours ago
Withlatex
yes, but not withpdflatex
.
– Herbert
21 hours ago
add a comment |Â
up vote
5
down vote
Here is a possible way to do it with tikzmark. (UPDATE: Rotation angles of the ellipses are no longer hard coded.)
documentclass[a4paper,12pt,hidelinks]article
usepackagemathtools
usepackagetikz
usetikzlibrarytikzmark,fit,shapes.geometric,calc
begindocument
titleTitle of the doc
authorme
datetoday
maketitle
sectionExample
beginequation*
beginvmatrix*[c]
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
tikzmarkm1&& ddots & vdots \
&tikzmarkm2&& a_nn
endvmatrix* =
beginvmatrix*[c]
a_11 &&tikzmarkm3& \
a_21 & a_22 &&tikzmarkm4 \
vdots & vdots & ddots & \
a_n1 & a_n2 & cdots & a_nn
endvmatrix* =
a_11a_22 dots a_nn
endequation*
begintikzpicture[overlay,remember picture]
path let p1=($(pic cs:m2)-(pic cs:m1)$),n1=atan2(y1,x1) in
node[ellipse,fit=(pic cs:m1)(pic cs:m2),draw,rotate fit=n1,inner sep=0pt,
yshift=4pt];
path let p1=($(pic cs:m4)-(pic cs:m3)$),n1=atan2(y1,x1) in
node[ellipse,fit=(pic cs:m3)(pic cs:m4),draw,rotate fit=n1,inner sep=0pt];
endtikzpicture
enddocument
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
Run with xelatex
documentclassarticle
usepackageamsmath
usepackagepstricks
begindocument
[
beginvmatrix
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
psellipse[rot=45](0.5,0)(0.3,0.6) & & ddots & vdots \
& & & a_nn
endvmatrix
=
beginvmatrix
a_11 & & & \
a_21 & a_22 & & psellipse[rot=45](-0.5,0.1)(0.3,0.6) \
vdots & vdots & ddots & \
a_n1 & a_n1 & cdots & a_nn
endvmatrix
= a_11, a_22cdots a_nn
]
enddocument
and the same with package tikz
[
beginvmatrix
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
tikz[overlay]draw (0.5,0) circle [x radius=3mm,y radius=6mm,rotate=45];
& & ddots &
vdots \
& & & a_nn
endvmatrix
=
beginvmatrix
a_11 & & & \
a_21 & a_22 & &
tikz[overlay]draw (-0.5,0.1) circle [x radius=3mm,y radius=6mm,rotate=45]; \
vdots & vdots & ddots & \
a_n1 & a_n1 & cdots & a_nn
endvmatrix
= a_11, a_22cdots a_nn
]
Whyxelatex
? I get the result also with "normal"latex
.
– campa
21 hours ago
Withlatex
yes, but not withpdflatex
.
– Herbert
21 hours ago
add a comment |Â
up vote
5
down vote
accepted
Run with xelatex
documentclassarticle
usepackageamsmath
usepackagepstricks
begindocument
[
beginvmatrix
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
psellipse[rot=45](0.5,0)(0.3,0.6) & & ddots & vdots \
& & & a_nn
endvmatrix
=
beginvmatrix
a_11 & & & \
a_21 & a_22 & & psellipse[rot=45](-0.5,0.1)(0.3,0.6) \
vdots & vdots & ddots & \
a_n1 & a_n1 & cdots & a_nn
endvmatrix
= a_11, a_22cdots a_nn
]
enddocument
and the same with package tikz
[
beginvmatrix
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
tikz[overlay]draw (0.5,0) circle [x radius=3mm,y radius=6mm,rotate=45];
& & ddots &
vdots \
& & & a_nn
endvmatrix
=
beginvmatrix
a_11 & & & \
a_21 & a_22 & &
tikz[overlay]draw (-0.5,0.1) circle [x radius=3mm,y radius=6mm,rotate=45]; \
vdots & vdots & ddots & \
a_n1 & a_n1 & cdots & a_nn
endvmatrix
= a_11, a_22cdots a_nn
]
Whyxelatex
? I get the result also with "normal"latex
.
– campa
21 hours ago
Withlatex
yes, but not withpdflatex
.
– Herbert
21 hours ago
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
Run with xelatex
documentclassarticle
usepackageamsmath
usepackagepstricks
begindocument
[
beginvmatrix
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
psellipse[rot=45](0.5,0)(0.3,0.6) & & ddots & vdots \
& & & a_nn
endvmatrix
=
beginvmatrix
a_11 & & & \
a_21 & a_22 & & psellipse[rot=45](-0.5,0.1)(0.3,0.6) \
vdots & vdots & ddots & \
a_n1 & a_n1 & cdots & a_nn
endvmatrix
= a_11, a_22cdots a_nn
]
enddocument
and the same with package tikz
[
beginvmatrix
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
tikz[overlay]draw (0.5,0) circle [x radius=3mm,y radius=6mm,rotate=45];
& & ddots &
vdots \
& & & a_nn
endvmatrix
=
beginvmatrix
a_11 & & & \
a_21 & a_22 & &
tikz[overlay]draw (-0.5,0.1) circle [x radius=3mm,y radius=6mm,rotate=45]; \
vdots & vdots & ddots & \
a_n1 & a_n1 & cdots & a_nn
endvmatrix
= a_11, a_22cdots a_nn
]
Run with xelatex
documentclassarticle
usepackageamsmath
usepackagepstricks
begindocument
[
beginvmatrix
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
psellipse[rot=45](0.5,0)(0.3,0.6) & & ddots & vdots \
& & & a_nn
endvmatrix
=
beginvmatrix
a_11 & & & \
a_21 & a_22 & & psellipse[rot=45](-0.5,0.1)(0.3,0.6) \
vdots & vdots & ddots & \
a_n1 & a_n1 & cdots & a_nn
endvmatrix
= a_11, a_22cdots a_nn
]
enddocument
and the same with package tikz
[
beginvmatrix
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
tikz[overlay]draw (0.5,0) circle [x radius=3mm,y radius=6mm,rotate=45];
& & ddots &
vdots \
& & & a_nn
endvmatrix
=
beginvmatrix
a_11 & & & \
a_21 & a_22 & &
tikz[overlay]draw (-0.5,0.1) circle [x radius=3mm,y radius=6mm,rotate=45]; \
vdots & vdots & ddots & \
a_n1 & a_n1 & cdots & a_nn
endvmatrix
= a_11, a_22cdots a_nn
]
edited 21 hours ago
answered 22 hours ago


Herbert
262k21395705
262k21395705
Whyxelatex
? I get the result also with "normal"latex
.
– campa
21 hours ago
Withlatex
yes, but not withpdflatex
.
– Herbert
21 hours ago
add a comment |Â
Whyxelatex
? I get the result also with "normal"latex
.
– campa
21 hours ago
Withlatex
yes, but not withpdflatex
.
– Herbert
21 hours ago
Why
xelatex
? I get the result also with "normal" latex
.– campa
21 hours ago
Why
xelatex
? I get the result also with "normal" latex
.– campa
21 hours ago
With
latex
yes, but not with pdflatex
.– Herbert
21 hours ago
With
latex
yes, but not with pdflatex
.– Herbert
21 hours ago
add a comment |Â
up vote
5
down vote
Here is a possible way to do it with tikzmark. (UPDATE: Rotation angles of the ellipses are no longer hard coded.)
documentclass[a4paper,12pt,hidelinks]article
usepackagemathtools
usepackagetikz
usetikzlibrarytikzmark,fit,shapes.geometric,calc
begindocument
titleTitle of the doc
authorme
datetoday
maketitle
sectionExample
beginequation*
beginvmatrix*[c]
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
tikzmarkm1&& ddots & vdots \
&tikzmarkm2&& a_nn
endvmatrix* =
beginvmatrix*[c]
a_11 &&tikzmarkm3& \
a_21 & a_22 &&tikzmarkm4 \
vdots & vdots & ddots & \
a_n1 & a_n2 & cdots & a_nn
endvmatrix* =
a_11a_22 dots a_nn
endequation*
begintikzpicture[overlay,remember picture]
path let p1=($(pic cs:m2)-(pic cs:m1)$),n1=atan2(y1,x1) in
node[ellipse,fit=(pic cs:m1)(pic cs:m2),draw,rotate fit=n1,inner sep=0pt,
yshift=4pt];
path let p1=($(pic cs:m4)-(pic cs:m3)$),n1=atan2(y1,x1) in
node[ellipse,fit=(pic cs:m3)(pic cs:m4),draw,rotate fit=n1,inner sep=0pt];
endtikzpicture
enddocument
add a comment |Â
up vote
5
down vote
Here is a possible way to do it with tikzmark. (UPDATE: Rotation angles of the ellipses are no longer hard coded.)
documentclass[a4paper,12pt,hidelinks]article
usepackagemathtools
usepackagetikz
usetikzlibrarytikzmark,fit,shapes.geometric,calc
begindocument
titleTitle of the doc
authorme
datetoday
maketitle
sectionExample
beginequation*
beginvmatrix*[c]
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
tikzmarkm1&& ddots & vdots \
&tikzmarkm2&& a_nn
endvmatrix* =
beginvmatrix*[c]
a_11 &&tikzmarkm3& \
a_21 & a_22 &&tikzmarkm4 \
vdots & vdots & ddots & \
a_n1 & a_n2 & cdots & a_nn
endvmatrix* =
a_11a_22 dots a_nn
endequation*
begintikzpicture[overlay,remember picture]
path let p1=($(pic cs:m2)-(pic cs:m1)$),n1=atan2(y1,x1) in
node[ellipse,fit=(pic cs:m1)(pic cs:m2),draw,rotate fit=n1,inner sep=0pt,
yshift=4pt];
path let p1=($(pic cs:m4)-(pic cs:m3)$),n1=atan2(y1,x1) in
node[ellipse,fit=(pic cs:m3)(pic cs:m4),draw,rotate fit=n1,inner sep=0pt];
endtikzpicture
enddocument
add a comment |Â
up vote
5
down vote
up vote
5
down vote
Here is a possible way to do it with tikzmark. (UPDATE: Rotation angles of the ellipses are no longer hard coded.)
documentclass[a4paper,12pt,hidelinks]article
usepackagemathtools
usepackagetikz
usetikzlibrarytikzmark,fit,shapes.geometric,calc
begindocument
titleTitle of the doc
authorme
datetoday
maketitle
sectionExample
beginequation*
beginvmatrix*[c]
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
tikzmarkm1&& ddots & vdots \
&tikzmarkm2&& a_nn
endvmatrix* =
beginvmatrix*[c]
a_11 &&tikzmarkm3& \
a_21 & a_22 &&tikzmarkm4 \
vdots & vdots & ddots & \
a_n1 & a_n2 & cdots & a_nn
endvmatrix* =
a_11a_22 dots a_nn
endequation*
begintikzpicture[overlay,remember picture]
path let p1=($(pic cs:m2)-(pic cs:m1)$),n1=atan2(y1,x1) in
node[ellipse,fit=(pic cs:m1)(pic cs:m2),draw,rotate fit=n1,inner sep=0pt,
yshift=4pt];
path let p1=($(pic cs:m4)-(pic cs:m3)$),n1=atan2(y1,x1) in
node[ellipse,fit=(pic cs:m3)(pic cs:m4),draw,rotate fit=n1,inner sep=0pt];
endtikzpicture
enddocument
Here is a possible way to do it with tikzmark. (UPDATE: Rotation angles of the ellipses are no longer hard coded.)
documentclass[a4paper,12pt,hidelinks]article
usepackagemathtools
usepackagetikz
usetikzlibrarytikzmark,fit,shapes.geometric,calc
begindocument
titleTitle of the doc
authorme
datetoday
maketitle
sectionExample
beginequation*
beginvmatrix*[c]
a_11 & a_12 & cdots & a_1n \
& a_22 & cdots & a_2n \
tikzmarkm1&& ddots & vdots \
&tikzmarkm2&& a_nn
endvmatrix* =
beginvmatrix*[c]
a_11 &&tikzmarkm3& \
a_21 & a_22 &&tikzmarkm4 \
vdots & vdots & ddots & \
a_n1 & a_n2 & cdots & a_nn
endvmatrix* =
a_11a_22 dots a_nn
endequation*
begintikzpicture[overlay,remember picture]
path let p1=($(pic cs:m2)-(pic cs:m1)$),n1=atan2(y1,x1) in
node[ellipse,fit=(pic cs:m1)(pic cs:m2),draw,rotate fit=n1,inner sep=0pt,
yshift=4pt];
path let p1=($(pic cs:m4)-(pic cs:m3)$),n1=atan2(y1,x1) in
node[ellipse,fit=(pic cs:m3)(pic cs:m4),draw,rotate fit=n1,inner sep=0pt];
endtikzpicture
enddocument
edited 22 hours ago
answered 23 hours ago


marmot
56.9k462124
56.9k462124
add a comment |Â
add a comment |Â
Ogrish Man is a new contributor. Be nice, and check out our Code of Conduct.
Ogrish Man is a new contributor. Be nice, and check out our Code of Conduct.
Ogrish Man is a new contributor. Be nice, and check out our Code of Conduct.
Ogrish Man is a new contributor. Be nice, and check out our Code of Conduct.
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%2f450548%2fhow-to-draw-a-circle-in-a-matrix-like-this%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
1
Welcome to TeX.SE! You certainly do not need photoshop for this. Could you please provide us with the code for the matrices without the "circle"?
– marmot
23 hours ago
OK, yes, let me do it and update the question. I just learned latex a few hours ago and this is a good chance to practice :)
– Ogrish Man
23 hours ago
The solution has been written long time ago here.
– Artificial Stupidity
23 hours ago