How to draw a circle in a matrix like this?

How to draw a circle in a matrix like this?



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?



enter image description here



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



enter image description here






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
Sep 12 '18 at 13:37






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
Sep 12 '18 at 13:39






The solution has been written long time ago here.

– The Inventor of God
Sep 12 '18 at 13:47




2 Answers
2



Run with xelatex


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



enter image description here



and the same with package tikz


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
]






Why xelatex? I get the result also with "normal" latex.

– campa
Sep 12 '18 at 15:00


xelatex


latex






With latex yes, but not with pdflatex.

– Herbert
Sep 12 '18 at 15:09


latex


pdflatex



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



enter image description here



Thanks for contributing an answer to TeX - LaTeX Stack Exchange!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế