How to get the following table?
How to get the following table?
I want to make this table:
Whereas, I get this one:
Any suggestions for the code I wrote below?
begincenter
begintabularc
& $A$ & NOT $A$ & SUM\ hline
$B$ & $P(A$ AND$,B)$ & $P($NOT $A$ AND$,B)$ & $P(B)$\
NOT $B$ &$P(A,$NOT$,B)$ &$P($NOT $A,$AND NOT$,B)$ & $P($NOT $B)$ \ hline
& $P(A)$ & $P($NOT $A)$& $1$\ hline
endtabular
endcenter
3 Answers
3
With no additional packages (I am assuming that Comic Sans is not your dream):
documentclassarticle
begindocument
begincenter
begintabularc
multicolumn1c& $A$ &multicolumn1c NOT $A$ &multicolumn1c SUM\
%hline
cline2-4
$B$ & $P(A$ AND$,B)$ & $P($NOT $A$ AND$,B)$ & $P(B)$\
NOT $B$ &$P(A,$NOT$,B)$ &$P($NOT $A,$AND NOT$,B)$ & $P($NOT $B)$ \
%hline
cline2-4
& $P(A)$ & $P($NOT $A)$& $1$\
%hline
cline2-4
endtabular
endcenter
enddocument
This is easy with blkarray
:
blkarray
documentclassarticle
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagemathtools, blkarray
begindocument
[ everymathdisplaystylesetlengthBAextrarowheight2pt
beginblockarraycccc
& A & textNOT A & textSUM \
BAhhline~---
beginblockc
B & P(Atext ANDB) & P(textNOT Atext AND B) & P(B)\
textNOT B &P(Atext NOT B) &P(textNOT Atext AND NOT B) & P(textNOT B) \
BAhhline~
& P(A) & P(textNOT A)& 1\
BAhhline~---
endblock
endblockarray ]
enddocument
please use
text
for SUM.– corvus_192
Aug 30 at 8:43
text
@corvus_192: Oh! yes, I forgot this cell. It's fixed. Thanks for pointing it!
– Bernard
Aug 30 at 9:08
Use multicolumn
command to suppress vertical ruling of specific cells. If the table width is not as you want, try to modify the width provided in textwidth
multicolumn
textwidth
documentclassarticle
usepackageamsmath
renewcommandarraystretch1.7
usepackageragged2e
usepackagetabularx
newcolumntypeC > arraybackslash Centering X
usepackagebooktabs
usepackagemakecell
begindocument
noindent
begintable*
centering
begintabularxtextwidth>hsize=1.5hsize C>hsize=1.5hsizeC
multicolumn1c & multicolumn1c$A$ & multicolumn1c$A^'$ & multicolumn1cSUM
\
Xcline2-40.2mm
$B$ & $P(A text AND B)$ & $P(textNOT A text AND B)$ & $P(B)$
\
$B^'$ & $P(A text AND NOT B)$ & $P(textNOT A text AND NOT B)$ & $P($NOT $B)$
\
Xcline2-40.2mm
& $P(A)$ & $P($NOT $A)$& $1$
\
Xcline2-40.2mm
endtabularx
endtable*
enddocument
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.
Welcome to TeX.SE! Can the text font not be the same?
– manooooh
Aug 30 at 1:08