top of page
Search

Tables and Matrices (LaTeX Series Part VI)

Updated: Oct 28, 2023

This article is based on the video LaTeX Tutorial pt 6 - Tables and Matrices in LaTeX, which teaches how to insert tables and matrices into a document. First, for creating tables, this requires the tabular environment, and can be coded with the following commands: “\begin{tabular}” and “\end{tabular}”.

  1. To specify the columns and rows of the table, this can be done with key words that are written directly after the tabular command. The letter “l” is a left-justified column, and “r” is a right-justified column, and “c” is a center column. Columns are added per letter; so, the command “\begin{tabular}{l c c c c c l}” will create 7 columns. To place lines between columns, add a “|” sign between the letters where lines will appear.

  2. To add information into each column, the information within each column should be separated by an empty line, and column entries will be separated by an “&” symbol. Each row will be finished with a “\\”(except for the last). To add horizontal lines, use the “\hline” command in between the information for each column (the number of lines that will be added correlates with the amound of “\hline” commands are written).

  3. In order to ensure that no text is cut off (if any comments are too long), add the “p{x cm}” command into the begin command for a table, which should maintain the width of the column it is written after and will not cut off text.

  4. To add captions, add the commands “\begin{table}” and “\end{table}” around the tabular commands, and add a caption with the command “\caption{insert caption name}” and label with the command “\label{tab: tri}”.


Matrices require the ams math package, and to use this package, add the command “\usepackage{amsmath}”.

  1. The code for the matrix will be written within the following commands: “\[“, a “\begin{matrix}” command on the next line, and end with the following commands: a “\]” and an “\end{matrix}” command.

  2. Entries within different columns are each written on separate lines, and entries within the same column are separated by an “&” symbol, and entries are ended with the “\\” sign. Different styles of matrices can be created by editing the environment- the “\begin{pmatrix}” creates a matrix with parentheses, “begin{bmatrix}” creates square brackets, “begin{Bmatrix}” creates curly brackets, “{begin{vmatrix}” uses vertical lines and “begin{Vmatrix}” uses double vertical lines.

2 views0 comments

Recent Posts

See All

Comments


bottom of page