28
$\begingroup$

I'm having a hard time to insert a table here when I'm asking a question. Any help would be appreciated. Also, is there any, not too expensive, math programs that allow me to enter math terms and equations kind of thing?

Thank you

Tom

$\endgroup$
3
  • $\begingroup$ Related on tables: meta.stackexchange.com/questions/73566/… $\endgroup$ Commented May 17, 2012 at 19:51
  • $\begingroup$ Have to tried www.wolframalpha.com ? :) $\endgroup$ Commented May 17, 2012 at 19:51
  • 1
    $\begingroup$ There is an entry on tables in the MathJax tutorial. Some support for tables is now available also in MarkDown, as illustrated in this answer. $\endgroup$ Commented Dec 9, 2020 at 4:51

3 Answers 3

37
$\begingroup$

Regarding how to write general math expressions on the site, my answer here covers that well I think.

Specifically for tables, you can use LaTeX's \array command. The tabular command, which only works in text mode, is not available here, so if you want to include text in your table, you will have to do some tinkering. Here is an example table:

$$\begin{array}{c|c|c|} 
 & \text{Column A} & \text{Column B} \\ \hline
\text{Row 1} & 5 & \oplus \\ \hline
\text{Row 2} & \int & 8 \\ \hline
\end{array}$$

produces

$$\begin{array}{c|c|c|} & \text{Column A} & \text{Column B} \\ \hline \text{Row 1} & 5 & \oplus \\ \hline \text{Row 2} & \int & 8 \\\hline \end{array}$$

$\endgroup$
3
  • 10
    $\begingroup$ +1 Great example! I adapted it to display $$\begin{array}{|c|c|c|}\hline&\zeta (3)&\zeta (2)\\ \hline\sigma&3+4\ln(1+4\sqrt{2})& 2+5\ln\left(\dfrac{1+\sqrt{5}}{2}\right)\\ \hline\tau&-3+4\ln(1+\sqrt{2})&-2+5\ln\left(\dfrac{1+\sqrt{5}}{2}\right)\\ \hline\mu=1+\dfrac{\sigma}{\tau}& \dfrac{8\ln(1+\sqrt{2})}{4\ln(1+\sqrt{2})-3}&\dfrac{10 \ln \left(\dfrac{1+\sqrt{5}}{2}\right)}{5 \ln\left(\dfrac{1+\sqrt{5}}{2}\right)-2}\\ \hline \end{array}$$ $\endgroup$ Commented May 18, 2012 at 0:24
  • $\begingroup$ +1 Thanks. I had to try it out on one of my answers. Sorry about the bump. $\endgroup$ Commented May 18, 2012 at 10:45
  • $\begingroup$ Somehow, it doesn't work anymore... $\endgroup$ Commented Aug 21, 2020 at 12:10
10
$\begingroup$

(This is a CW answer, everybody is welcome to extend or improve it.)

Markdown support for tables has been enabled network-wide, this offers an alternative to the MathJax/LaTeX array environment for simple tables. MathJax can be used inside the Markdown table entries.

A simple example

Source:

| Function | Addition theorem |
| -------- | ---------------- |
| **Sine** | $\sin(x+y) = \sin(x) \cos(y) + \cos(x) \sin(y)$ |
| **Cosine** | $\cos(x+y) = \cos(x) \cos(y) - \sin(x) \sin(y)$ |

Result:

Function  Addition theorem
Sine $\sin(x+y) = \sin(x) \cos(y) + \cos(x) \sin(y)$
Cosine $\cos(x+y) = \cos(x) \cos(y) - \sin(x) \sin(y)$

More examples:

Source:

| What | MathJax |
| -------- | -------------- |
| Matrix   | $\begin{pmatrix}1&2\\0&1\end{pmatrix}$ |
| Equation with a tag | \begin{equation} x^2+y^2=z^2 \tag{1} \end{equation}  |
| Centered formula    | $$F_{n+2}=F_{n+1}+F_n$$ |

Result:

What MathJax
Matrix $\begin{pmatrix}1&2\\0&1\end{pmatrix}$
Equation with a tag \begin{equation} x^2+y^2=z^2 \tag{1} \end{equation}
Centered formula $$F_{n+2}=F_{n+1}+F_n$$

Resources

Notes

  • There is currently a bug when MathJax is used in the Markdown table header.
$\endgroup$
7
$\begingroup$

Since my example given in a comment to Zev Chonoles's answer and adapted from it, due to some reason, does not display properly now, I repeat it here.

$$\begin{array}{|c|c|c|}\hline&\zeta (3)&\zeta (2)\\\hline\sigma&3+4\ln(1+4\sqrt{2})&2+5\ln\left(\dfrac{1+\sqrt{5}}{2}\right)\\\hline\tau&-3+4\ln(1+\sqrt{2})&-2+5\ln\left(\dfrac{1+\sqrt{5}}{2}\right)\\\hline\mu=1+\dfrac{\sigma}{\tau}&\dfrac{8\ln(1+\sqrt{2})}{4\ln(1+\sqrt{2})-3}&\dfrac{10\ln\left(\dfrac{1+\sqrt{5}}{2}\right)}{5\ln\left(\dfrac{1+\sqrt{5}}{2}\right)-2}\\\hline\end{array}$$

It is produced by

$$\begin{array}{|c|c|c|} \hline &\zeta (3)&\zeta (2)\\ \hline \sigma&3+4\ln(1+4\sqrt{2})&2+5\ln\left(\dfrac{1+\sqrt{5}}{2}\right)\\ \hline \tau&-3+4\ln(1+\sqrt{2})&-2+5\ln\left(\dfrac{1+\sqrt{5}}{2}\right)\\ \hline \mu=1+\dfrac{\sigma}{\tau}&\dfrac{8\ln(1+\sqrt{2})}{4\ln(1 \sqrt{2})-3}& \dfrac{10\ln\left(\dfrac{1+\sqrt{5}}{2}\right)} {5\ln\left(\dfrac{1+\sqrt{5}}{2}\right)-2}\\ \hline \end{array}$$

$\endgroup$
2
  • 1
    $\begingroup$ Amusingly, without even first looking at your post, I noticed that your comment had broken and then proceeded to fix it, figuring that it's the same problem I was having here. Should I rebreak it? $\endgroup$ Commented Jun 5, 2012 at 13:13
  • $\begingroup$ That or perhaps better you could add a short comment explaining how you have fixed it. $\endgroup$ Commented Jun 5, 2012 at 13:48

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.