# How to draw a truth table on Stack Exchange?

I need to draw/input tables, such as truth tables in order to ask and answer questions about logic. Can someone please instruct me on how to make a truth table on this site.

My goal is to make a truth table with inputs (X,~X) and outputs (X AND ~X),(X OR ~X),(X XOR ~X), (X NOR ~X),(X XNOR ~X), where AND = conjunction, OR = inclusive disjunction, XOR = exclusive disjunction, NOR = joint denial (i.e. neither X nor ~X), and XNOR = exclusive nor (i.e. complement of XOR).

Please leave me instructions on how to implement such a truth table here on Stack Exchange. Your help is much appreciated.

• For how to draw tables by hand, see meta.stackexchange.com/q/73566/332957. Jun 26 '20 at 20:40
• If you go to a StackExchange site for Math, Computer Science, etc., they have MathJax enabled which allows use of TeX (a subset of LaTeX). This can enable you to specify tables, equations, figures, etc.. Unfortunately, many StackExchange sites don't yet have MathJax enabled, so these features aren't available at such sites, e.g. SE.Philosophy. You may want to consider a different stack for posts that'd contain more than simple text.
– Nat
Jul 13 '20 at 21:24

Unfortunately, Markdown (the syntax StackExchange uses to format text) does not support tables.

With the recent change to CommonMark, the chances that we will get proper table support in the future have become much, much higher, but we ain't there yet.

On sites with MathJax enabled, you can of course use MathJax to create tables with the table or array environment.

On Philosophy.SE, MathJax is as far as I can tell not enabled. Until table support in CommonMark is activated, the best you can do is leverage code markup to get monospaced text and use ASCII-Tables.

There are various generator for ASCII Tables out there that can help you with the layout. Such a table might look like this:

+----+----+---+
| OR | A  | B |
+----+----+---+
|  0 |  0 | 0 |
|  1 |  0 | 1 |
|  1 |  1 | 0 |
|  1 |  1 | 1 |
+----+----+---+


I used this generator, but there are literally thousands out there that help with creating a layout.

This generator for example can produce tables with the proper Unicode border characters, looking like this:

╔═══╦═══╦═════╗
║ A ║ B ║ AND ║
╠═══╬═══╬═════╣
║ 0 ║ 0 ║ 0   ║
╠═══╬═══╬═════╣
║ 0 ║ 1 ║ 0   ║
╠═══╬═══╬═════╣
║ 1 ║ 0 ║ 0   ║
╠═══╬═══╬═════╣
║ 1 ║ 1 ║ 1   ║
╚═══╩═══╩═════╝