Tables in LaTex

  • #1
Stephen Tashi
Science Advisor
6,928
1,183

Main Question or Discussion Point

Do LaTex tables work in forum posts? I've never used them before. Today I tried copying several examples from pages on the web such as:

[tex]
\begin{tabular}{ l c r }
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 \\
\end{tabular}
[/tex]

which on my browser doesn't show up as a table. I tried using math renderers HTML-CSS and SVG.
I don't see any syntax error in that example, but, as I said, I've never tried to write tables in LaTex before.
 

Answers and Replies

  • #2
LCKurtz
Science Advisor
Homework Helper
Insights Author
Gold Member
9,508
730
Do LaTex tables work in forum posts? I've never used them before. Today I tried copying several examples from pages on the web such as:

[tex]
\begin{tabular}{ l c r }
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 \\
\end{tabular}
[/tex]

which on my browser doesn't show up as a table. I tried using math renderers HTML-CSS and SVG.
I don't see any syntax error in that example, but, as I said, I've never tried to write tables in LaTex before.
That syntax is fine for a LaTeX document. I'm no expert on this, but I think "tabular" is an environment variable, and they aren't generally supported here.

Disclaimer: Someone who knows what they are talking about may correct me.
 
  • #3
18,039
7,396
We use MathJax which accepts most LaTeX commands, but it does not accept the tabular environment. Some here have used Arrays to fake a table.
 
  • #4
AlephZero
Science Advisor
Homework Helper
6,993
291
On PF (and presumably any MathJax application) your input is interpreted in LaTex "math mode", as if it were between ##\$ \dots \$## or ##\$\$ \dots \$\$## in "standard" LaTeX.

So you can't use environments like "tabular" that are meant to be used outside of math mode.
 
  • #5
DrGreg
Science Advisor
Gold Member
2,272
750
Do LaTex tables work in forum posts? I've never used them before. Today I tried copying several examples from pages on the web such as:

[tex]
\begin{tabular}{ l c r }
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 \\
\end{tabular}
[/tex]

which on my browser doesn't show up as a table. I tried using math renderers HTML-CSS and SVG.
I don't see any syntax error in that example, but, as I said, I've never tried to write tables in LaTex before.
Consulting our LaTeX FAQ, you can get the effect you want via
Code:
\begin{array}{| l | c | r |}
\hline
  1 & 2 & 3 \\
\hline
  4 & 5 & 6 \\
\hline
  7 & 8 & 9 \\
\hline
\end{array}
[tex]
\begin{array}{| l | c | r |}
\hline
1 & 2 & 3 \\
\hline
4 & 5 & 6 \\
\hline
7 & 8 & 9 \\
\hline
\end{array}[/tex]
 

Related Threads for: Tables in LaTex

  • Last Post
Replies
9
Views
871
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
9
Views
6K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
5
Views
763
  • Last Post
Replies
5
Views
5K
Replies
1
Views
7K
  • Last Post
Replies
18
Views
22K
Top