3

enter image description here

This is the table I want to recreate. I've created the table, but I'm unsure how to create the arrow-label thing. Here's my code -

\documentclass[12pt,twoside,a4paper]{report}
\pagestyle{headings}
  \usepackage[utf8]{inputenc}
   \usepackage{amsmath}
   \usepackage{amssymb}
\usepackage{graphicx}
  \usepackage{tikz}   
  \usepackage{syntonly}
  \usepackage{amsthm}
  \usepackage{float}
  \usepackage{mparhack}
  \usepackage{marginnote}
  \usepackage{marginfix}
  \usepackage[most]{tcolorbox}
  \usepackage{cancel}
  \usepackage{booktabs} % -For prettier tables
  
  \usepackage{geometry}
  \geometry{left=2.7cm,top=4cm,bottom=4cm,right=5cm,marginparwidth=3.5cm,marginparsep=1cm}
 
\begin{document}

\begin{table}[H]
          \centering
                  \begin{tabular}{c|c|c}
                          \toprule
                          $p$ & $\sim p$ & $\sim(\sim p)$ \\
                          \midrule
                          T & F & T \\
                          F & T & F \\
                          \bottomrule
                   \end{tabular}
           \caption{}
           \label{}
   \end{table}

\end{document}

Any ideas?

2 Answers 2

4

Like this:

enter image description here

This table is simple to draw using matrix library:

\documentclass[12pt,twoside,a4paper]{report}
\usepackage[hmargin={2.7cm,5cm},vmargin={4cm,=4cm},
            marginparwidth=3.5cm, marginparsep=1cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, 
                matrix}

  
\begin{document}
    \begin{table}[ht]
    \centering
\begin{tikzpicture}[
arr/.style = {draw=cyan, Straight Barb-Straight Barb, semithick},
lbl/.style = {font=\small, text=cyan, align=center, anchor=#1}
                    ]
\matrix (m) [matrix of nodes,
             nodes={draw=cyan, minimum height=4ex, minimum width=4.4em,
                    anchor=center, outer sep=0pt},
             column sep=-\pgflinewidth, row sep=-\pgflinewidth
             ]
{
$p$ & $\sim p$  & $\sim(\sim p)$    \\
T   &       F   &       T           \\
F   &       T   &       F           \\
};
\path[arr]
    (m-3-1.south) --++ (0,-1)  
                 -| node[pos=0.25, lbl=north] {$p$ and $\sim(\sim p)$ always have\\
                         the same values, so they\\
                         are logical equivalednt} (m-3-3);
\end{tikzpicture}
\caption{True table}
\label{tab:true}
   \end{table}
\end{document}
3

With {NiceTabular} of nicematrix and Tikz.

\documentclass[12pt,twoside,a4paper]{report}
\usepackage{geometry}
\usepackage{nicematrix,tikz}
 
\begin{document}

\begin{center}
\renewcommand{\arraystretch}{1.3}
\begin{NiceTabular}{ccc}[hvlines,rules/color=cyan,columns-width=auto]
  $p$ & $\sim p$ & $\sim(\sim p)$ \\
  T & F & T \\
  F & T & F \\
\CodeAfter
\begin{tikzpicture}
  \draw [cyan,->]
    (4-|1.5) --++ (0,-1)  
             -| node [pos=0.25,anchor=north,align=center,font=\small] 
                     {$p$ and $\sim(\sim p)$ always have\\
                         the same values, so they\\
                         are logical equivalent} (4-|3.5);
\end{tikzpicture} 
\end{NiceTabular}
\end{center}

\end{document}

You need several compilations (because of the PGF/Tikz nodes).

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .