Making Tables in LaTeX - 2017 Update

  • LaTeX
  • Thread starter Stephen Tashi
  • Start date
  • Tags
    2017 Latex
In summary, there are ways to create tables in the forum implementation of Latex, although the "tabular" environment was not implemented in 2012. Instead, users can use the MathJax functionality to create matrices, which can be formatted to resemble tables by adding vertical lines or using the "cases" environment. This information has been added to the LaTeX Primer for future reference.
  • #1
Stephen Tashi
Science Advisor
7,861
1,599
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
  • #2
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.
 
  • #3
We have matrices. Like tables without lines.

\begin{matrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{m
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
  • #4
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}
 
  • #6
Thanks! I've added it to our LaTeX Primer, in the section that has examples of matrices.
 
  • Like
Likes Greg Bernhardt

Related to Making Tables in LaTeX - 2017 Update

1. What is LaTeX and why is it useful for making tables?

LaTeX is a typesetting system that is commonly used in the scientific community for creating professional-looking documents, including tables. It is useful for making tables because it offers a high level of customization and allows for precise control over the formatting and layout of tables.

2. How do I create a basic table in LaTeX?

To create a basic table in LaTeX, you can use the \begin{tabular} and \end{tabular} commands. Within these commands, you can specify the number of columns and the alignment of each column. Then, you can use the & symbol to separate the different columns and the \\ symbol to start a new row.

3. What are some useful packages for creating tables in LaTeX?

Some useful packages for creating tables in LaTeX include booktabs, which allows for the creation of professional-looking tables with customizable rules and spacing, and tabularx, which allows for tables with automatic column width calculation.

4. How can I add headers and captions to my table in LaTeX?

To add headers and captions to your table in LaTeX, you can use the \caption and \label commands. You can specify the table title in the \caption command and add a label for cross-referencing purposes. Then, you can use the \hline command to add horizontal lines to separate the header from the rest of the table.

5. Are there any online resources or tutorials for learning how to make tables in LaTeX?

Yes, there are many online resources and tutorials available for learning how to make tables in LaTeX. Some popular resources include the LaTeX Wikibook and the Overleaf documentation, which provide step-by-step instructions and examples for creating tables in LaTeX.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
961
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
927
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Back
Top