Truth Tables in LaTeX

Typesetting truth tables has never been easy. LaTeX is the gold standard for displaying logic and mathematics, but tables are awkward to edit at best. Tables are much simpler in Microsoft Word, but displaying formulas is a horrible experience.1 Here is my current workflow.

The text that I’m using this semester is Introduction to Formal Logic with Philosophical Applications by Russell Marcus. Instead of arrows and the ampersand, it uses the horseshoe, triple bar, and dot. So, I add the following lines to my LaTeX preamble to simplify entering the symbols.2

\newcommand{\lneg}{\mathord{\sim}}
\renewcommand{\land}{\bullet}
\newcommand{\lif}{\supset}
\newcommand{\liff}{\equiv}

Then, I enter the truth table in either Excel or Numbers. For example, this would be a simple one line table determining the truth value of a formula for a given valuation:

Numbers truth table

Copy the cells that you want included in the truth table. Go to Tables Generator, and select “LaTeX Tables” from the top menu bar. Below the top menu bar is a drop-down menu bar. Click on “File” then “Paste table data…” and paste the table data. Table Generator will generate a nicely formatted LaTeX table:

\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{llllllll}
P & Q & R & P & \lif & (\lneg Q & \land & R) \\
1 & 1 & 1 & 1 & 0 & 0 & 0 & 1
\end{tabular}
\end{table}

I delete the first four lines and the last line, leaving just the table data and the lines declaring the tabular environment:

\begin{tabular}{cccccccc}
P & Q & R & P & \lif & (\lneg Q & \land & R) \\
1 & 1 & 1 & 1 & 0 & 0 & 0 & 1
\end{tabular}

At this point, typesetting will fail because the symbols need to be in math mode. So, I’ve found two options. The first is to put all the commands for the symbols in math mode:

\begin{tabular}{cccccccc}
P & Q & R & P & \(\lif\) & (\(\lneg\) Q & \(\land\) & R) \\
1 & 1 & 1 & 1 & 0 & 0 & 0 & 1
\end{tabular}

The second option is to change “tabular” to “array” and put the entire table into math mode:

\[
\begin{array}{cccccccc}
P & Q & R & P & \lif & (\lneg Q & \land & R) \\
1 & 1 & 1 & 1 & 0 & 0 & 0 & 1
\end{array}
\]

Arrays are centered on the page. If you would prefer them printed at the left margin, add “fleqn” to the document class options: \documentclass[fleqn]{article} Since the array is in math mode, the letters will be italicized. I use the newtxmath font package, and it has a “frenchmath” option that sets the math font to non-italic. Other math fonts may have a similar option.

Finally, whichever option is used, we need to add two lines. Adding a vertical line character to the table or array formatting options will place a vertical line between the valuation section and the rest of the truth table. Adding the booktabs package to the preamble will allow us to separate the sentence from the rest of the truth table.

This gives us the final version,

\[
\begin{array}{ccc|ccccc}
P & Q & R & P & \lif & (\lneg Q & \land & R) \\ \midrule
1 & 1 & 1 & 1 & 0 & 0 & 0 & 1
\end{array}
\]

which produces this:

Truth Table


  1. Apple’s Pages now allows users to add formulas with LaTeX. It’s looking like a good solution for those who like more traditional word processors. 
  2. The AMS LaTeX packages already include a command called “\lor” for entering the vee or wedge. 

Prayer for the Fourth Sunday of Advent

A prayer for Mitch Randall’s last Sunday as pastor of NorthHaven Church, before he takes his new position as executive director of the Baptist Center for Ethics.

God of peace and joy,

For centuries,
Israel anticipated
the coming of the Messiah;
and as one expectation
was fulfilled,
another was born,
for we still long
for the day when
that same Messiah
will come again.

Christmas is still a day
when old dreams are fulfilled,
and new dreams are born.

We give thanks for what
this church has become
in the years that Mitch
has been with us:

For those who have
been rejected,
it is a place to feel welcome.

For those who have
felt constrained,
a place to be free.

For those whose gifts
have been denied,
a place to serve.

And so it is fitting
that at Christmas
We share with the world.
this gift that we have received,

And may we, through our
words, actions, and gifts,
declare to the world
that there is still
good news of glad tidings,
for all people, everywhere.

Amen

Ordination Prayer

This is a prayer for the ordination service of Kim Divelbiss at NorthHaven Church on December 9, 2017

God of grace and hope,

We confess that, sometimes,
we are like Israel in Egypt,
overwhelmed by life and
tempted to believe that
you have abandoned your people.

In this, though, we have hope,
though Israel had forgotten you,
you did not abandon her.
Instead, you called Moses
to be her minister.

And so, from the desert
of our dry and parched lives,
you continue to call —
not from a burning bush,
but from within,
from a heart aflame
with passion for
the kingdom of God
and for your people.

Today, we give thanks for Kim,
a minister with such a heart,
who, like Moses,
has answered your call.

Grant her the vision
to see things as they are,
and the spiritual imagination
to recognize what they could be.

May her laughter be joyful;
her anger, righteous;
her compassion, gentle;
her witness, bold;
and her love, deep.

Fill her with the
power of the Almighty,
who took what was
formless and void
and created the universe,
then declared it good.

May her ministry
be the means by which
you continue to take
what is broken and empty,
and create that which is
new, beautiful and good.

In the name of the Father
who gives us our mission,
and of the Son,
whose obedience is our model,
and of the Spirit,
who gives us strength
for our task.

Three persons,
one God,
forever and ever.

Amen

Ethics of War Handout

These are some concepts and terms used in a presentation on the ethics of war, given at Oklahoma Baptist University on December 1, 2017.

Pacifism

Consequentialist Pacifism: Although war is not intrinsically wrong, the benefits of war are always outweighed by the costs.

Deontological Pacifism: War is always intrinsically wrong, regardless of its consequences.

Doctrine of Double Effect

War could be permissible, even if we know that innocent lives will be lost, if

  1. Taking innocent life is not the reason that we go to war,
  2. The lives that are saved are proportionally greater than the lives that will be lost,
  3. Taking innocent life is not the means to saving lives, and
  4. Saving lives is otherwise permissible.

Just War

Jus ad bellum: Conditions that determine when a state can justly go to war.

Jus in bello: Conditions that specify how a war must be fought

Jus post bellum: Conditions that determine when one can justly end hostilities.

Jus ad bellum Jus in bello Jus post bellum
Just cause Obey international law Just cause
Right intention Discrimination Right intention
Proper authority/declaration Proportionality Discrimination
Last resort Humane treatment of POW’s Proportionality
Probability of success No means mala in se
Proportionality No reprisals

Just Peacemaking

Ten principles of just peacemaking: 1

  1. Support nonviolent direct action.
  2. Take independent initiatives to reduce threat.
  3. Use cooperative conflict resolution.
  4. Acknowledge responsibility for conflict and injustice and seek repentance and forgiveness.
  5. Advance democracy, human rights, and religious liberty.
  6. Foster just and sustainable economic development.
  7. Work with emerging cooperative forces in the international system.
  8. Strengthen the United Nations and international efforts for cooperation and human rights.
  9. Reduce offensive weapons and weapons trade.
  10. Encourage grassroots peacemaking groups and voluntary associations.

  1. From Just Peacemaking: Ten Practices for Abolishing War, 2d ed., edited by Glen Stassen (Pilgrim Press, 2004). [return]
Quote

Moltmann on Peace

Peace is not merely the absence of war; it is also the overcoming of injustice and oppression. In positive terms, it is life that is blessed, affirmed, loved and successful–life as shalom. Anyone who wants to serve peace must serve life. He must therefore resist war, because this is the deadliest form of discord. But this resistance against war is only one part of a much wider devotion to life. The service of peace is the whole task of life.

Jürgen Moltmann, The Power of the Powerless