This is a typical table from Elliott Mendelson's Introduction to Mathematical Logic.
This is part of a method for determining if a statement form is a tautology. I would like to be able to reproduce it in an efficient way.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityYou can do it quick, or you can do it well. It's pretty hard to do it both. You'll notice even the one you posted, which I gather is taken right from Mendelson's published book, is screwed up. The T in line 2 should be under the biconditional, not under the A.
The best approach I can think of is to use an array (or tabular). The hard thing is to make the formula at the top have something like its usual mathematical spacing. If you break each statement and connective into its own cell, the usual LaTeX math spacing rules will get ignored. So what you basically have to do is use @{…}
in the column specifier between every column, and put in spaces @{\ }
before and after the binary connectives, and remove all inter-column space @{}
elsewhere.
The resulting code is a little ugly:
\documentclass{article}
\usepackage{array}
\usepackage{amssymb}
\usepackage{mathpazo}% optional: a font more like Mendelson's
\newcommand{\F}{\mathrm{F}}
\newcommand{\T}{\mathrm{T}}
\begin{document}
\newcounter{tableline}
\setcounter{tableline}{0}
\newcommand{\advline}{\refstepcounter{tableline}\thetableline}
\[
\begin{array}%
{@{}r@{}c@{\ }c@{\ } r@{}r@{} c@{}l@{\ }c@{\ }c@{}l@{\ }c@{\ } r@{}r@{} c@{}l@{\ }c@{\ } c@{}l@{\ }c@{}}
(( &A &\Leftrightarrow&(( &\lnot&B &) &\lor &C &)) &\Rightarrow&(( &\lnot&A &) &\Rightarrow&B &)) & \\
& & & & & & & & & &\F & & & & & & & & \advline\\
& &\T & & & & & & & & & & & & &\F & & & \advline\\
& & & & & & & & & & & &\T & & & &\F & & \advline\\
&\F & & & & & & & & & & & &\F & & & & & \advline\\
& & & & & & &\F & & & & & & & & & & & \advline\\
& & & &\F & & & &\F & & & & & & & & & & \advline\\
& & & & &\T & & & & & & & & & & & & & \advline\\
\end{array}
\]
\end{document}
I put in spaces in the column specifier so you can see which column specification goes with which column. (I made the columns for left parentheses right-aligned and those for right parentheses left-aligned to stick with what they apply to, but I doubt that matters.)
The output looks like this:
You could probably use lua to write a script that automatically parsed the statement and put in the right kind of spacing (and while you're at, fill in the rest of the table, as computers are pretty good at truth functional logic …) But that's more work than I'm willing to do for a StackExchange answer.
array
environment and careful manipulation of spacing (needs some knowledge of TeX spacing rules etc. I think) to make the first line correct.