1
\$\begingroup\$

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

| |
\$\endgroup\$
  • \$\begingroup\$ @PeterJ Doesn't MathJax include some kind of table tool? \$\endgroup\$ – Asmyldof Apr 3 '16 at 11:08
  • \$\begingroup\$ @Asmyldof yes you're right forgot about that, but anyway best moved to meta so it can be properly answered. \$\endgroup\$ – PeterJ Apr 3 '16 at 11:11
  • 1
    \$\begingroup\$ Not sure if you get excited: meta.electronics.stackexchange.com/a/2829/8627 \$\endgroup\$ – jippie Apr 3 '16 at 12:18
  • \$\begingroup\$ 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. \$\endgroup\$ – Transistor Apr 3 '16 at 12:44
  • \$\begingroup\$ meta.stackexchange.com/questions/216606/… \$\endgroup\$ – SDsolar Jun 1 '17 at 7:55
6
\$\begingroup\$

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}$$

| |
\$\endgroup\$
  • 2
    \$\begingroup\$ 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. \$\endgroup\$ – jippie Apr 4 '16 at 19:33
  • 1
    \$\begingroup\$ That looks very nice... but man, the code is horrendous. \$\endgroup\$ – rdtsc Apr 19 '16 at 4:00
3
\$\begingroup\$

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.

| |
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .