3

How can I create a table in a question ? I have tried HTML but it does not seem to work.

$\begin{tabular}{ l c r } 1 & 2 & 3 \ 4 & 5 & 6 \ 7 & 8 & 9 \ \end{tabular}$

AapNoot

$$ \begin{array}{lcr} 1 & 2 & 3 \ 4 & x^2 & 6 \ 7 & 8 & 9 \ \end{array} $$

2
  • The Markdown docs talks about using inline html for it, but I can't seem to produce more than a single row at once. – rcollyer Jan 27 '12 at 14:59
  • There's a discussion of how markdown and html tables are disabled in the stackexchange network over here and here and lots of other linked questions (on the right). – Simon Jan 28 '12 at 4:36
3

I suggest you use a code block, and hand format the table, taking advantage of the fixed width font. This is very easy to copy.

  one   two
 ------------

  1.0   2.1

  2.3   4.6

If you need mathematics in the table, you can use something like this:

$$
\begin{array}{lcr} 
1 & 2 & 3  \\
4 & x^2 & 6  \\
7 & 8 & 9  \\
\end{array}
$$

This can't be copied, so I don't really recommend it unless your table is really a matrix, or must contain formulae


Or you can just post an image. Again, this can't be copied, so use it only if you really need the formatting to show something, but no one will want to re-enter it.

Mathematica graphics

5
  • Have you noticed that I demonstrated in the question that the second part of your answer ( LaTeX ) does not work in StackExchange ( MathJax ). I queried about it at the MathJax site and their philosophy is ( was then ) that formatting should be handled by HTML. It is LaTeX for -internet-. - So basically StackExchange does not support tables then. I think I'll use an image then, copying won't be necessary. – nilo de roock Jan 27 '12 at 12:31
  • @ndroock1 Your code does not work, but the one in my post does. Note the difference. I took care to correct it. Also note that MathJax is not enabled on meta, but works on the main site. – Szabolcs Jan 27 '12 at 12:36
  • Not enabled on meta. Yikes. – nilo de roock Jan 27 '12 at 13:10
  • The LaTeX solution can be copied into Mma. If you right-click on a MathJax object you can see the underlying LaTeX. This can be then imported into Mma using ToExpression[string, TeXForm] or ImportString[StringReplace[string, clean_up_rules]]. That said, a code block is easier - and can be copied straight from a TableForm output in Mma. – Simon Jan 28 '12 at 4:32
  • @Simon I know, but often the result is imperfect and requires manual fixup. We just had an example of posting uncopyable LaTeX. Not posting code that's meant to be copies as LaTeX should be in the FAQ. – Szabolcs Jan 28 '12 at 23:01

You must log in to answer this question.

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