Math-Linux.com

Knowledge base dedicated to Linux and applied mathematics.

Home > Latex > FAQ > Latex - FAQ > How to write table in Latex ? \begintabular...\endtabular

How to write table in Latex ? \begin{tabular}...\end{tabular}

All the versions of this article: [English] [français]

Environment

You must use the tabular environment.

Description of columns

Description of the columns is done by the letters r, l or c
- r right-justified column
- l left-justified column
- c centered column

A column can be defined by a vertical separation | or nothing.

When several adjacent columns have the same description, a grouping is possible:

*{nb_columns}{description}

Lines description

- \hline provides a horizontal line between two lines
- The symbol & separates each column.
- The symbol \}} makes a new line
- \cline{i-j} horizontal line between columns i and j

Exemple :

\begin{center}
 \begin{tabular}{| l | c || r | }
   \hline
   1 & 2 & 3 \\ \hline
   4 & 5 & 6 \\ \hline
   7 & 8 & 9 \\
   \hline
 \end{tabular}
\end{center}

\begin{tabular}{|*{2}{c|}l r|}
  \hline
  math & linux & dot & com \\
  center & center& left  & right \\
  \hline
  $\sigma$ & $\alpha$ & $\rho$  & $\theta$ \\
  \hline
\end{tabular}

\begin{tabular}{|r|l|}
 \hline
 2B & hexadecimal \\
 53 & octal \\ \cline{2-2}
 101011 & binary \\
 \hline \hline
 43 & decimal \\
 \hline
\end{tabular}

Any message or comments?

comments powered by Disqus