4
$\begingroup$

Here's a link to a SE question-answer on building tables using Latex. I copied the following bit of Latex code from the top-rated answer and when I pasted it in to an answer on Chemistry SE it didn't produce the expected part of the table. Is Latex not fully supported on Chemistry SE, or did I make some kind of error?

\begin{table} \centering \caption{A data table.} \label{tbl:1} \begin{tabular}{c c} A & B \\ C & D \end{tabular} \end{table}

EDIT: So if the {table} method doesn't work in MathJax, how, using the {align} method, could I rework the table MannishEarth created in his answer, but with the first row continuous (no columns in only the first row) with "123" centered within it

$\endgroup$
5
$\begingroup$

The \begin{table}...\end{table} would create a floating object, which is not really possible in a website anyways.

Since \multicolumn{3}{c}{1 2 3} is not permitted in arrays, arrays inside arrays is your only option.

$$ \begin{array}{c} \text{a b c}\\\hline \begin{array}{c|c|c} 1 & 2 & 3\\ 4 & 5 & 6\\ 7 & 8 & 9\\ \end{array} \end{array} $$

$\endgroup$
2
  • $\begingroup$ Thanks Martin, I'm going to play around with this. $\endgroup$
    – ron
    Jul 1 '14 at 14:06
  • $\begingroup$ @ron You are welcome, however, I would recommend avoiding them as often as possible, it is almost always coding pain, as it is easy to forget a parentheses/ closing argument... and then you are searching longer for the error than it took to post the answer :/ $\endgroup$ Jul 2 '14 at 9:05
6
$\begingroup$

$$\begin{array}{c|c|c} 1 & 2 & 3\\ \hline 2 & 4 & 5\\ 1 & 5 & 6 \end{array}$$

\begin{array} works (right click for mathjax source)

That being said, MathJax only supports a subset of LaTeX. It's not for general typesetting, so expect a lot of LaTeX features to be missing.

$\endgroup$
5
  • $\begingroup$ @MannishEarth Thanks Mannish! "expect a lot of LaTeX features to be missing" Aha, I guess that explains it. I did wind up using the "\begin{array}" method. If I wanted the first row to be continuous (no columns in only the first row) with "123" centered within it, is there a way to accomplish that? $\endgroup$
    – ron
    Jun 29 '14 at 20:51
  • $\begingroup$ @ron uh, I think so, but I forgot exactly how the LaTeX array syntax works. $\endgroup$ Jun 30 '14 at 7:06
  • 2
    $\begingroup$ The background is that MathJax focuses on math-mode LaTeX. The table environment is a text-mode macro and thus not in scope (it fits more naturally with markdown, I suppose). For a complete list of TeX macros supported by MathJax, see docs.mathjax.org/en/latest/tex.html#supported-latex-commands $\endgroup$ Jun 30 '14 at 9:01
  • $\begingroup$ Thanks for the link Peter. The link on that page leading to Carol Fisher's treasure trove of MathJax illustrated commands was a good one too. onemathematicalcat.org/MathJaxDocumentation/TeXSyntax.htm $\endgroup$
    – ron
    Jun 30 '14 at 13:12
  • $\begingroup$ Be aware, that you will have to escape text in tables via \text{...}, otherwise it will be set as variables. Unfortunately on meta.se it does not say why the status is declined: meta.stackexchange.com/q/73566/260760 $\endgroup$ Jul 1 '14 at 10:45

You must log in to answer this question.

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