How to get the following table?

How to get the following table?



I want to make this table: enter image description here



Whereas, I get this one: enter image description here
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





Welcome to TeX.SE! Can the text font not be the same?
– manooooh
Aug 30 at 1:08




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



enter image description here



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



enter image description here





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



enter image description here



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.

Popular posts from this blog

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

Edmonton

Crossroads (UK TV series)