3

Enter image description here

How can I draw the table in LaTeX? Particularly the content bottom of the table?

3
  • 6
    I suggest using matrix library of TikZ. What have you tried so far?
    – Black Mild
    Dec 18 '20 at 11:06
  • 2
    Welcome to TeX.SX! On this site, a question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed because they are either "off topic", "too broad", or "unclear". Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help.
    – NBur
    Dec 18 '20 at 11:36
  • For arrow with label below table you can use tikzmark library.
    – Zarko
    Dec 18 '20 at 11:43
10

You can do that with an ordinary array and pstricks: I defined the last elements in columns 5 and 8 as \rnodes and connected with the relevant node connection. Note that the pstricks part of the code, used this way, has no dimension for latex, so I added a supplementary row containing only a vertical space, to prevent any overlapping with the following text.

\documentclass{article}
\usepackage{array}
\usepackage{bm}
\usepackage[semibold, condensed]{cabin}
\usepackage[usestackEOL]{stackengine}
\usepackage{pst-node}

\begin{document}

\[
\setlength{\extrarowheight}{3pt}
\begin{array}{ |*{8}{c|}}
\hline
\bm{A} & \bm{B} & \bm{C} & \bm{B\cap C}& \bm{A \cup ∪ (B \cap C)}& \bm{A \cup B}& \bm{A \cup C}& \bm{(A \cup B)\cap(A \cup C)} \\
\hline
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 \\
0 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\
1 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\
1 & 0 & 1 & 0 & 1 & 1 & 1 & 1 \\
1 & 1 & 0 & 0 & 1 & 1 & 1 & 1 \\
1 & 1 & 1 & 1 & \rnode{A}{1} & 1 & 1 & \rnode{B}{1} \\
\hline
\multicolumn{8}{c}{\vspace{4ex}}%
\ncbar[linewidth=0.6pt, arrows=<->, arrowinset=0.12,angle=-90, nodesep=1.5ex]{A}{B}
\nbput{\sffamily\bfseries\small \Shortunderstack{Since these columns are identical, we conclude \\%
 that $\;\bm{A\cup(B\cap C)=(A \cup B) \cap (A \cup C)}$}}
\end{array}
\]

\end{document} 

enter image description here

7
  • Nice answer (+1)! How you type unicode symbols ∪ and ∩? Using WinEdt so far I didn't find them at my keyboard.
    – Zarko
    Dec 18 '20 at 13:09
  • Zarko: I should have checked the code. Initially, I typed the usual latex commands, but actually, my version of WinEdt uses a macro that saves symbols or Greek letters as the corresponding latex commands, but displays them as the symbols, to make the code more readable, mathematically. I'll fix that within seconds.
    – Bernard
    Dec 18 '20 at 13:16
  • Thank you very much for info. Onence I need to look in my WinEdt settings and macros and refresh my understanding of unicode (how to simple access symbols by keys in keyboard). Maybe over holidays ...
    – Zarko
    Dec 18 '20 at 13:23
  • If you're interested, I'm the author of the MathGreek configuration component on WinEdt.org
    – Bernard
    Dec 18 '20 at 13:34
  • Good to know. I'm interested, of course. Thank you. I will look there ASAP.
    – Zarko
    Dec 18 '20 at 13:43
7

Let me extend my comment to answer:

\documentclass{article}
\usepackage{bm}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                tikzmark}
\usepackage{lipsum}

\begin{document}
\[
\renewcommand\arraystretch{1.2}
\begin{array}{ |*{8}{c|}}
    \hline
\bm{A} & \bm{B} & \bm{C} & \bm{B\cap C}& \bm{A\cup (B\cap C)}
    & \bm{A\cup B} & \bm{A\cup C} & \bm{(A\cup B)\cap (A \cup C)} \\
    \hline
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 \\
0 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\
1 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\
1 & 0 & 1 & 0 & 1 & 1 & 1 & 1 \\
1 & 1 & 0 & 0 & 1 & 1 & 1 & 1 \\
1 & 1 & 1 & 1 & \tikzmarknode{a}{1} 
                  & 1 & 1 & \tikzmarknode{b}{1} \\
\hline
\end{array}
\vspace{4\baselineskip} % <--- space for arrow
\tikz[>=Straight Barb, overlay,remember picture]%
{
\draw[<->, semithick, shorten <=2ex, shorten >=2ex]
    (a) -- ++ (0,-1) -|
    node[align=center,font=\bfseries, pos=0.25, below]
        {Since these columns are identical, we conclude \\%
         that $\;\bm{A\cup(A\cap C)=(A\cup B)\cap (A\cup C)}$}
                        (b); 
}
\]
\lipsum[1]
\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.