How to Create Tables in LaTeX?

  • LaTeX
  • Thread starter Saladsamurai
  • Start date
  • Tags
    Latex
In summary, the conversation discusses using the tabular environment and its limitations in MathJax, as well as alternatives such as using the array environment to create tables.
  • #1
Saladsamurai
3,020
7
Can seem to make it work? Am I missing something?

[tex]
\begin{tablular}{c c c}
P & Q & R \\
S & T & V
\end{tablular}
[/tex]
 
Physics news on Phys.org
  • #2
The tabular environment is currently not supported by mathjax. So you'll have to use another environment for this.

See http://www.mathjax.org/docs/1.1/tex.html#supported-latex-commands [Broken] for all currently supported commands and environment.

See https://www.physicsforums.com/showthread.php?t=546968 for alternatives to the tabular environment.
 
Last edited by a moderator:
  • #3
Saladsamurai said:
Can seem to make it work? Am I missing something?

[tex]
\begin{tablular}{c c c}
P & Q & R \\
S & T & V
\end{tablular}
[/tex]

fyi, we don't use LaTeX anymore. We use MathJax which supports LaTeX markup. Sometimes you can create a table structure using array.
 
  • #4
Thanks folks! I just used an array. I miss being able to add an \hline though :frown:
 
  • #5
\hline works in array. For example:

Code:
[tex]\begin{array}{c|cc}
\hline
A & B & C\\
\hline
D & E & F\\
\hline
\end{array}
[/tex]

gives

[tex]\begin{array}{c|cc}
\hline
A & B & C\\
\hline
D & E & F\\
\hline
\end{array}
[/tex]
 

What is the tabular environment in LaTeX?

The tabular environment in LaTeX is a tool used to create tables within a document. It allows for precise control over the layout and formatting of the table, including the placement of columns and rows, alignment of text, and the addition of borders and lines.

How do I create a basic table using the tabular environment?

To create a basic table using the tabular environment, you will need to define the number of columns and their alignment, and then input the data for each row. For example, the command \begin{tabular}{|c|c|c|} will create a table with 3 centered columns, and the command \hline will add horizontal lines between rows.

Can I add formatting to my table using the tabular environment?

Yes, the tabular environment allows for many formatting options to be applied to the table. This includes adjusting column width, changing font styles, adding color, and merging cells. These formatting commands can be inserted within the table's data to target specific cells or applied to the entire table.

What is the difference between the tabular and tabbing environments in LaTeX?

The tabular environment is used to create tables with a fixed number of columns, while the tabbing environment allows for a variable number of columns. Additionally, the tabbing environment allows for tab stops to be set, whereas the tabular environment does not. This makes the tabbing environment better suited for creating lists or outlining information.

Can I include math equations in a table using the tabular environment?

Yes, the tabular environment supports the use of math equations within the table. You can use the $ symbol to enter math mode and then input your equation as you would in a regular document. However, it is important to note that the spacing and alignment may be affected by the use of math equations in a table.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
312
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
884
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
731
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
862
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
869
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
156
Back
Top