# How do you draw a truth table on stack electronic?

I am new to this site and trying to figure out how to draw a truth table on the site. Can someone help please ?

• @PeterJ Doesn't MathJax include some kind of table tool? – Asmyldof Apr 3 '16 at 11:08
• @Asmyldof yes you're right forgot about that, but anyway best moved to meta so it can be properly answered. – PeterJ Apr 3 '16 at 11:11
• Not sure if you get excited: meta.electronics.stackexchange.com/a/2829/8627 – jippie Apr 3 '16 at 12:18
• If the MathJAX is a bit complicated then start each line with four spaces and type your text in fixed-space font. Use |, + and _ to create table borders. – Transistor Apr 3 '16 at 12:44
• meta.stackexchange.com/questions/216606/… – SDsolar Jun 1 '17 at 7:55

It is possible to do tables in MathJax, but it's generally more trouble than it's worth. I usually just use ASCII art with "code" formatting (control-K).

$$\begin{array}{|c|c|} \hline X & P(X = i) \\\hline 1 & 1/6 \\\hline 2 & 1/6 \\\hline 3 & 1/6 \\\hline 4 & 1/6 \\\hline 5 & 1/6 \\\hline 6 & 1/6 \\\hline \end{array}$$

$$\begin{array}{|c|c|} \hline X & P(X = i) \\\hline 1 & 1/6 \\\hline 2 & 1/6 \\\hline 3 & 1/6 \\\hline 4 & 1/6 \\\hline 5 & 1/6 \\\hline 6 & 1/6 \\\hline \end{array}$$

• Karnaugh maps are even more fun ;o) I know I've done a MathJax KM once, but I've reverted to ASCII art or a screen grab from a spreadsheet ever since. – jippie Apr 4 '16 at 19:33
• That looks very nice... but man, the code is horrendous. – rdtsc Apr 19 '16 at 4:00

I just tried it, and the HTML TABLE tag is apparently not supported. Here are some options:

1. Apparently it's possible with MathJax somehow.

2. Use fixed-formatted text within PRE /PRE tags.

3. Use something like Excel to make your table, print it to a image file or take a screen shot, trim it properly, then include it here as a image. The software here will shrink your image if it is more than 620 (or is that 630?) pixels wide, so don't exceed that. It won't be shown wider anyway, but the system will probably introduce artifacts and decrease readability if it resizes the image for you.