0

I want to typeset a truth table where the truth values of a complex formula are aligned with the corresponding connectives as shown in the attachment. Would someone know a solution? Thanks in advance!

enter image description here

3
  • What should the alignment be? Centred, I assume.
    – Werner
    Oct 25, 2023 at 16:48
  • 2
    This could be done in a basic tabular. What have you tried? Oct 25, 2023 at 17:10
  • 1
    @Werner The aim is to align the truth values (0s and 1s) with the logical connectives in the wffs (the not or the implication in not-A implies B). In my answer below, for example, you can see I've not done the final column because the truth values aren't quite centred under the main logical connective (ampersand). The question assumes discipline-specific knowledge. Without it, it is unclear as well as lacking an MWE.
    – cfr
    Oct 25, 2023 at 17:24

1 Answer 1

2

You've provided no code, so I don't think I ought to answer this question. However, this only required a quick modification to code I happened to have.

Basically, you can use a tabular with c and @{} column and column separation specifiers. It's a bit fiddly, but it works reasonably well. The final column in this example and simple negations of atoms are left as exercises for the reader.

When separating two wffs or two sentential letters, use cc. When separating part of a wff from another part, use c@{}c to avoid the separation between columns.

\documentclass[border=5pt]{standalone}
\newcommand*{\tnot}{\ensuremath{\mathord{\sim}}}
\begin{document}
  \begin{tabular}{*{3}{c}|c@{}cc@{}c@{}c@{}cc}$P$&$Q$&$R$&$\tnot$&$(P \lor R)$&$\tnot$ & $(Q $ &$\,\&\,$&$\tnot R)$&$\tnot P \,\&\, \tnot Q$\\
  \hline
  1&1&1&0&1 &1&&0&&0 \\
  1&1&0&0&1 &0&&1&&0 \\
  1&0&1&0&1 &1&&0&&0 \\
  1&0&0&0&1 &1&&0&&0 \\
  0&1&1&0&1 &1&&0&&0 \\
  0&1&0&1&0 &0&&1&&0 \\
  0&0&1&0&1 &1&&0&&1 \\
  0&0&0&1&0 &1&&0&&1 \\
\end{tabular}
\end{document}

alignment with connectives in truth table

2
  • 1
    Thank you so much and sorry for me breach! I tweaked you solution for my use a bit: ``` \begin{longtable}{||c|c|c|c@{}c@{}c@{}c@{}c@{}c@{}c||} \hline $A$&$B$&$A \land B$&$\lnot$ &$($&$\lnot$ & $A $ &$\,\lor\,$&$\lnot$ & $B)$ \\ \hline \hline 1&1&1 &\textbf{1}&&0&&0&0& \\ 1&0&0 &\textbf{0}&&0&&1&1& \\ 0&1&0 &\textbf{0}&&1&&1&0& \\ 0&0&0 &\textbf{0}&&1&&1&1& \\ \hline \end{longtable} ``` Cheers!
    – pahohu
    Oct 25, 2023 at 22:23
  • 1
    @pahohu The trick is to keep track of your columns. If you make a mistake, add several extra columns temporarily because it is easier to figure out where the error is. (But maybe you are less prone to typos than me.)
    – cfr
    Oct 25, 2023 at 22:26

You must log in to answer this question.

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