5

How to make left justify in table?

\begin{document}
\begin{table}
    0               && 0 \\
    3x + y                          && 7\\
    3x                          && -675+867i\\
    x                 && \\
    \end{table}
\end{document}

I do not know why does not work?

2
  • 3
    The table building environments are tabular and array. Can you be more specific about what you want to achieve?
    – egreg
    Oct 6, 2015 at 23:15
  • 1
    It is good to start from en.wikibooks.org/wiki/LaTeX/Tables
    – CroCo
    Oct 7, 2015 at 1:05

3 Answers 3

7

In LaTeX terminology, a table is a "floating environment", meaning that it may get typeset not exactly where it's encountered in the input file but somewhere else (usually not too far away though) in order to obtain a decent page layout. The main content of a table environment -- other content being, for instance, the table's caption, legend, and table-related footnotes -- is usually placed inside a tabular environment (if the tabular material is mostly text) or an array environment (if the material is mostly math).

Left-alignment of the contents of a column is achieved by using the l column type, specified as an argument to \begin{tabular} or \begin{array}. To change the distance between columns, modify either \tabcolsep (for tabular environments) or \arraycolsep (for array environments).

In the case of your example, I would suggest you use an array environment, as it contains all mathy stuff.

enter image description here

\documentclass{article}
\begin{document}

\begin{table}
%\centering %% uncomment this if the "array" should be centered
\setlength\arraycolsep{10pt} % default value: 5pt
$\begin{array}{ll}           % "ll" sets up two left-aligned columns
    0               & 0 \\
    3x + y          & 7 \\
    3x              & -675+867i\\
    x               & \\
\end{array}$
\end{table}

\end{document}
3
  • 1
    It should be noted that the parameter following the \begin{array} defines the number and alignment of columns. Oct 7, 2015 at 2:18
  • @JosephMontanaro - thanks for this; I'll add a comment to the code
    – Mico
    Oct 7, 2015 at 5:11
  • 1
    Also, if you don't want it to float, just remove the table environment, and just keep the array.
    – Mark
    Oct 7, 2015 at 5:21
10
\begin{tabular}{ccc}
\end{tabular}

ccc show 3 columns and center positionings. You can use lll or rrr for left and right positioning

1
  • 3
    The question was explicitly about how to get left-justified columns. Your code should address the question.
    – Mico
    Oct 9, 2015 at 5:20
0

You can pull your whole table more to the left by using @{} in the definition of the columns:

\begin{tabular}{@{}ccc} 
;;;
\end{tabular}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .