LaTeX Making Tables in LaTeX - 2017 Update

  • Thread starter Thread starter Stephen Tashi
  • Start date Start date
  • Tags Tags
    2017 Latex
AI Thread Summary
The discussion centers on the limitations of using LaTeX for creating tables in forum implementations, particularly with MathJax, which has been in use since around 2011. The "tabular" environment is not available, but users can create table-like structures using the "matrix" environment. Examples illustrate how to format matrices to resemble tables, including vertical lines using "vmatrix" and adding horizontal lines with "\hline." The conversation also touches on the parsing behavior of MathJax, noting that matrix environments do not require dollar signs for delimiters. Overall, while traditional table formatting is not possible, users can achieve similar visual results with matrices and other environments.
Stephen Tashi
Science Advisor
Homework Helper
Education Advisor
Messages
7,864
Reaction score
1,602
Is there a way to do tables in the forum implementation of Latex?

( I asked this question in 2012 and the "tabular" environment wasn't implemented.)
 
Physics news on Phys.org
Stephen Tashi said:
Is there a way to do tables in the forum implementation of Latex?

( I asked this question in 2012 and the "tabular" environment wasn't implemented.)
I think there are a few ways and I'll let the gurus explain. Just to be clear, since 2011 or so we moved to MathJax which focuses on pure math and does not have explicit "tabular" functionality.
 
We have matrices. Like tables without lines.

\begin{matrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{m[/color]atrix}

(Why does MathJax parse the table even without $ delimiters if you don't play ugly tricks?)

$$\begin{matrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{matrix}$$

Vertical lines with vmatrix:

$$\begin{vmatrix}
1 \\
a \\
x
\end{vmatrix}
\begin{matrix}
2\\
b\\
y
\end{matrix}
\begin{vmatrix}
3 \\
c \\
z
\end{vmatrix} $$

With \hline added:

$$\begin{vmatrix}
1 \\ \hline
a \\ \hline
x
\end{vmatrix}
\begin{matrix}
2\\ \hline
b\\ \hline
y
\end{matrix}
\begin{vmatrix}
3 \\ \hline
c \\ \hline
z
\end{vmatrix} $$

Not perfect, but it looks table-like.
 
  • Like
Likes Greg Bernhardt
mfb said:
(Why does MathJax parse the table even without $ delimiters if you don't play ugly tricks?)
I think it's because matrix is an environment, and for some reason you don't need to include the $ or # start/end tags.
It works the same way with other environments such as cases (I think environment is the correct terminology):
f(x) = \begin{cases} 1 & x > 0 \\ 0 & x < 0 \end{cases}
 
Thanks! I've added it to our LaTeX Primer, in the section that has examples of matrices.
 
  • Like
Likes Greg Bernhardt

Similar threads

Replies
4
Views
2K
Replies
3
Views
3K
Replies
9
Views
2K
Replies
12
Views
3K
Replies
8
Views
2K
Replies
8
Views
3K
Replies
3
Views
1K
Back
Top