Tabella (o simile) di matematica visualizzata numerata
Voglio fare riferimento a una "tabella" di equazioni, ma voglio che ogni "cella" sia numerata. Tutte le risposte che ho visto di qualcosa di simile riguardano le linee di numerazione, ma mi piacerebbe numerare anche le singole celle. Ecco il codice minimo:
\begin{align*} \begin{array}{c|c|c} p & q & p\wedge q\\\hline 1 & 1 & 1\\\hline 1 & 0 & 0\\\hline 0 & 1 & 0\\\hline 0 & 0 & 0 \\ \end{array} &&& \begin{array}{c|c|c} p & q & p\vee q\\\hline 1 & 1 & 1\\\hline 1 & 0 & 1\\\hline 0 & 1 & 1\\\hline 0 & 0 & 0 \\ \end{array}\\[1.3ex] \begin{array}{c|c|c} p & q & p\veebar q\\\hline 1 & 1 & 0\\\hline 1 & 0 & 1\\\hline 0 & 1 & 1\\\hline 0 & 0 & 0 \\ \end{array}&&& \begin{array}{c|c} p & \neg p\\\hline 1 & 0 \\\hline 0 & 1\\ \end{array} \end{align*}
Di seguito è riportato uno screencap dell'output; quello che voglio è che ogni tabella di verità abbia il proprio tag (non necessariamente un numero, solo per poterlo usare \tagsu ciascuna) in modo che io possa fare riferimento a loro in seguito.
Risposte
Ecco una soluzione con tabularx:
\documentclass[12pt]{report}
\usepackage{amsmath, amssymb}
\usepackage{tabularx}
\begin{document}
Some text. Some more text.
{\centering \renewcommand{\tabularxcolumn}[1]{m{#1}}
\begin{tabularx}{\textwidth}{@{}XX@{}}
\begin{equation}\label{TT:AND}
\begin{array}{c|c|c}
p & q & p\wedge q\\\hline
1 & 1 & 1\\\hline
1 & 0 & 0\\\hline
0 & 1 & 0\\\hline
0 & 0 & 0
\end{array}
\end{equation} &
\begin{equation}\label{TT:OR}
\begin{array}{c|c|c}
p & q & p\vee q\\\hline
1 & 1 & 1\\\hline
1 & 0 & 1\\\hline
0 & 1 & 1\\\hline
0 & 0 & 0
\end{array}
\end{equation} \\[-2ex]
%
\begin{equation}
\begin{array}{c|c|c}\label{TT:XOR}
p & q & p\veebar q\\\hline
1 & 1 & 0\\\hline
1 & 0 & 1\\\hline
0 & 1 & 1\\\hline
0 & 0 & 0
\end{array}
\end{equation}&
\begin{equation}\label{TT:NEG}
\begin{array}{c|c}
p & \neg p\\\hline
1 & 0 \\\hline
0 & 1
\end{array}
\end{equation}
\end{tabularx}\vskip -1ex
}
Text continuation.
\end{document}
Ecco una soluzione che (a) colloca ogni arrayambiente in un equationambiente, (b) posiziona ogni equationambiente in un minipageambiente di larghezza 0.5\linewidthe (c) posiziona i quattro minipageambienti in un centerambiente. L'incorporamento degli minipageambienti in un centerambiente assicura che ci sarà un po 'di spazio bianco sopra e sotto il gruppo di quattro array.
\documentclass{article}
\usepackage{array} % for '\extrarowheight' macro
\usepackage{amssymb} % for '\veebar' macro
\begin{document}
\begin{center}
\setlength\extrarowheight{1pt} % for a less "cramped" look
\begin{minipage}{0.5\linewidth}\begin{equation}\begin{array}{c|c|c}
p & q & p\wedge q \\ \hline
1 & 1 & 1 \\ \hline
1 & 0 & 0 \\ \hline
0 & 1 & 0 \\ \hline
0 & 0 & 0
\end{array}\end{equation}\end{minipage}%
\begin{minipage}{0.5\linewidth}\begin{equation}\begin{array}{c|c|c}
p & q & p\vee q \\ \hline
1 & 1 & 1 \\ \hline
1 & 0 & 1 \\ \hline
0 & 1 & 1 \\ \hline
0 & 0 & 0
\end{array}\end{equation}\end{minipage}
\vspace{5mm} % or whatever amount of vertical spacing you prefer
\begin{minipage}{0.5\linewidth}\begin{equation}\begin{array}{c|c|c}
p & q & p\veebar q \\ \hline
1 & 1 & 0 \\ \hline
1 & 0 & 1 \\ \hline
0 & 1 & 1 \\ \hline
0 & 0 & 0
\end{array}\end{equation}\end{minipage}%
\begin{minipage}{0.5\linewidth}\begin{equation}\begin{array}{c|c}
p & \neg p \\ \hline
1 & 0 \\ \hline
0 & 1 \\
\end{array}\end{equation}\end{minipage}
\end{center}
\end{document}