TeX - LaTeX Asked by Francesco Tallarico on January 8, 2021
Good evening,
I’m trying to achieve following picture in latex, but i can’t do it. Can someone help me?
This is what I have so far:
documentclass[a4paper,12pt]{scrartcl}
usepackage{booktabs}
usepackage[utf8] {inputenc}
usepackage[ngerman]{babel}
usepackage{amsmath}
usepackage{amssymb}
usepackage{amsfonts}
usepackage[T1]{fontenc}
begin{document}
begin{center}
$left(begin{array}{rrrr}
2&2&-1&3
cmidrule{2-4}
0&1&3&4
0&1&3&4
0&3&9&6
0&1&3&-2
end{array}right)$
end{center}
end{document}
You're missing the vertical line |
in the column specification and a multicolumn{1}{r}
for the element in the top left corner:
documentclass{article}
begin{document}
[
left(
begin{array}{ r | *{3}{r} }
multicolumn{1}{r}{2} & 2 & -1 & 3
cline{2-4}
0 & 1 & 3 & 4
0 & 1 & 3 & 4
0 & 3 & 9 & 6
0 & 1 & 3 & -2
end{array}
right)
]
end{document}
For a more evenly distributed spacing around the last three columns, consider using phantom{-}2
in the first row:
documentclass{article}
begin{document}
[
left(
begin{array}{ r | *{3}{r} }
multicolumn{1}{r}{2} & phantom{-}2 & -1 & 3
cline{2-4}
0 & 1 & 3 & 4
0 & 1 & 3 & 4
0 & 3 & 9 & 6
0 & 1 & 3 & -2
end{array}
right)
]
end{document}
Correct answer by Werner on January 8, 2021
With nicematrix
. The environments of nicematrix
create PGF/Tikz nodes under the rows, columns and cells and the array and it's possible to use them to draw whatever you want with Tikz.
documentclass{article}
usepackage{nicematrix}
usepackage{tikz}
begin{document}
[
begin{pNiceMatrix}[r,right-margin,columns-width=auto]
2 & 2 & -1 & 3
0 & 1 & 3 & 4
0 & 1 & 3 & 4
0 & 3 & 9 & 6
0 & 1 & 3 & -2
CodeAfter
tikz draw ([xshift=4pt]row-6-|col-2) |- (row-2-|col-5) ;
end{pNiceMatrix}
]
end{document}
Answered by F. Pantigny on January 8, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP