这是我想要重新创建的表格。我已经创建了表格,但不确定如何创建箭头标签。这是我的代码 -
\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}
有任何想法吗?
答案1
像这样:
使用库可以很容易地绘制此表matrix
:
\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}
答案2
使用{NiceTabular}
和nicematrix
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}
您需要多次编译(因为 PGF/Tikz 节点)。