# How can I make a truth table?

For some questions and answers - I would have liked to make a truth table.

Is there a way to make a truth table OR generally any table?

Yes, tables are possible with MathJax. Here's an example, taken from Mathematics.SE:

$$\begin{array}{c|lcr} n & \text{Left} & \text{Center} & \text{Right} \\ \hline 1 & 0.24 & 1 & 125 \\ 2 & -1 & 189 & -8 \\ 3 & -20 & 2000 & 1+10i \end{array}$$

This table was created with the following MathJax code:

$$\begin{array}{c|lcr} n & \text{Left} & \text{Center} & \text{Right} \\ \hline 1 & 0.24 & 1 & 125 \\ 2 & -1 & 189 & -8 \\ 3 & -20 & 2000 & 1+10i \end{array}$$


So, here's a simple truth table example:

$$p \land q \\ \begin{array}{c|c} p & q & p \land q \\ \hline T & T & T \\ T & F & F \\ F & T & F \\ F & F & F \\ \end{array}$$

$$p \land q \\ \begin{array}{c|c} p & q & p \land q \\ \hline T & T & T \\ T & F & F \\ F & T & F \\ F & F & F \\ \end{array}$$

• Thanks a ton for clearing it up @Doorknob :) – pranav Jan 1 '15 at 4:34

Stack Exchange now has table support

Markdown-based tables are preferable in vast majority of situations where tables are required. To demonstrate why, I'll make a table.

Feature Markdown MathJax
Table looks like a table to visual-based users Yes Yes
Spreadsheet-friendly (Can you copy-paste?) Yes No
Right/Left/Center align columns Yes Yes
Easy to explain/type out Yes** No
Merge cells or toggle borders on/off No Yes
Looks pretty Yes*** No
Ability to create tables without header rows No**** Yes

Very few tables absolutely require merged cells or the ability to control which borders show up. If your table does, then fine, use MathJax. Otherwise use Markdown. For accessibility, if nothing else.

The main-meta link above has a more in-depth tutorial. Here's how to make the two example tables in the MathJax answer, using Markdown formatting.

n Left Center Right
1 0.24 1 125
2 -1 189 -8
3 -20 2000 1+10i
| n | Left | Center | Right |
|---|:-----|:------:|------:|
| 1 | 0.24 | 1      | 125   |
| 2 | -1   | 189    | -8    |
| 3 | -20  | 2000   | 1+10i |


p∧q

p q p∧q
T T T
T F F
F T F
F F F
p∧q

| p | q | p∧q |
|---|---|-----|
| T | T | T   |
| T | F | F   |
| F | T | F   |
| F | F | F   |


* This is because MathJax, especially complicated MathJax such as tables, is difficult for screen readers to understand as intended. Markdown tables create tables in the underlying HTML code and can therefore be read by any half-competent screen reader.
** Both my opinion and backed up by how much less special syntax is required
*** An opinion shared by @Lukas Rotter and @Sciborg
**** But you can just leave the header row blank

Doorknob's answer is perfect, but I would like to point to an easy-alternative (useful in some cases): Use Windword/Excel/whatever to create your table. Do a quick screen-shot (CTRL + Print) and cut out the table from the image (to keep file-size small.) Then upload as an image.

(Disadvantages, of course, no copy&paste of the content for readers and not so easy to correct.)