TeX - LaTeX Asked by jkool on May 2, 2021
I thought offinterlineskip
would remove the vertical spacing between the rows, but it does not seem to work. I want a small spacing before the last row only.
Does someone know what is going wrong here?
This is the code for the confusion matrix:
{
offinterlineskip
centering
hspace*{0.9cm}MyHBoxy{A}MyHBoxy{B}MyHBoxy{C}MyHBoxy{D}MyHBoxy{PA}par
MyTBoxy{A}{$N_{AA}$,$N_{AB}$,$N_{AC}$,$N_{AD}$}{$dfrac{N_{AA}}{sum_{Ap}}$}
MyTBoxy{B}{$N_{BA}$,$N_{BB}$,$N_{BC}$,$N_{BD}$}{$dfrac{N_{AA}}{sum_{Bp}}$}
MyTBoxy{C}{$N_{CA}$,$N_{CB}$,$N_{CC}$,$N_{CD}$}{$dfrac{N_{AA}}{sum_{Cp}}$}
MyTBoxy{D}{$N_{DA}$,$N_{DB}$,$N_{DC}$,$N_{DD}$}{$dfrac{N_{AA}}{sum_{Dp}}$}
vspace*{2.5px}
MyTBoxy{UA}{$dfrac{N_{AA}}{sum_{An}}$,$dfrac{N_{BB}}{sum_{Bn}}$,$dfrac{N_{CC}}{sum_{Cn}}$,$dfrac{N_{DD}}{sum_{Dn}}$}{-}
}
Boxes:
newcommandMyVBox[1]{%
parbox[c][.8cm][c]{1cm}{centeringbfseries #1}%
}
newcommandMyHBoxy[2][dimexpr1.25cm+2fboxseprelax]{%
parbox[c][1.35cm][c]{#1}{centeringbfseries #2}%
}
newcommandboxy[1]{%
fbox{parbox[c][1.25cm][c]{1.25cm}{centering #1}}%
}
newcommandMyTBoxy[3]{%
MyVBox{#1}
renewcommand*do[1]{boxy{##1}hspace*{-fboxrule}}
docsvlist{#2}
boxy{#3}parvspace{-fboxrule}
}
Like this?
As simple table with use hhline
for horizontal and vertical rules in table, and `makecell for more vertical space in the last column's cells:
documentclass[varwidth, margin=3mm]{standalone}
%documentclass{article}
usepackage{hhline, makecell}
newcommandmcbf[1]{multicolumn{1}{c}{mathbf{#1}}}
begin{document}
[
setcellgapes{3pt}
makegapedcells
begin{array}{r|*{4}{c|} |c|}
mcbf{} & mcbf{A} & mcbf{B} & mcbf{C} & mcbf{D} & mcbf{PA}
hhline{~|----||-|}
mathbf{A} & N_{AA} & N_{AB} & N_{AC} & N_{AD} & dfrac{N_{AA}}{sum_{Ap}}
hhline{~|----||-|}
mathbf{B} & N_{BA} & N_{BB} & N_{BC} & N_{BD} & dfrac{N_{AA}}{sum_{Bp}}
hhline{~|----||-|}
mathbf{C} & N_{CA} & N_{CB} & N_{CC} & N_{CD} & dfrac{N_{AA}}{sum_{Cp}}
hhline{~|----||-|}
mathbf{D} & N_{DA} & N_{DB} & N_{DC} & N_{DD} & dfrac{N_{AA}}{sum_{Dp}}
hhline{~:====::=:}
mathbf{UA} & dfrac{N_{AA}}{sum_{An}}
& dfrac{N_{BB}}{sum_{Bn}}
& dfrac{N_{CC}}{sum_{Cn}}
& dfrac{N_{DD}}{sum_{Dn}}
& -
hhline{~|----||-|}
end{array}
]
end{document}
Correct answer by Zarko on May 2, 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