Making Tables in LaTeX - 2017 Update

  • Context: LaTeX 
  • Thread starter Thread starter Stephen Tashi
  • Start date Start date
  • Tags Tags
    2017 Latex
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
5 replies · 2K views
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   Reactions: 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}