Aller au contenu

You can add a caption to a table by wrapping the tabular environment in a table environment:

\begin{table}
\caption{Your caption.}
\label{demo-table}
\begin{tabular}
...
\end{tabular}
\end{table}

The following code, which also uses the center environment, demonstrates adding a table caption. It also uses \label{demo-table} to create a label for use in referencing the table (via \ref{demo-table}):

\documentclass{article}
\begin{document}
Table \ref{demo-table} has a caption:
\begin{table}[!h]
\begin{center}
\caption{Your caption.}
\label{demo-table}
\begin{tabular}{||c c c c||} 
 \hline
 Col1 & Col2 & Col2 & Col3 \\ [0.5ex] 
 \hline\hline
 1 & 6 & 87837 & 787 \\ 
 \hline
 2 & 7 & 78 & 5415 \\
 \hline
 3 & 545 & 778 & 7507 \\
 \hline
 4 & 545 & 18744 & 7560 \\
 \hline
 5 & 88 & 788 & 6344 \\ [1ex] 
 \hline
\end{tabular}
\end{center}
\end{table}
\end{document}

 Open this example in Overleaf

This example produces the following output, with the table centred on the page:

Adding a table caption to a table in LaTeX

Note that the table environment will also let the table "float" to where LaTeX thinks it should go. Here, we applied the float placement specifier !h to place the table "here", encouraging LaTeX to locate it below the line of text. If you want more control over float placement, you can use additional specifiers as described in this section of the LaTeX Wikibook.

Overleaf guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

Advanced TeX/LaTeX