Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have three tables in latex and I'm trying to put them right below each other. The first and the second table is displayed correctly but the third will go to another page. The code I have is this:

\floatsep -0.2pt plus 0.2pt minus 0.2pt
\begin{table}[ht]
\centering  % used for centering table
\begin{tabular}{|c |c| c| c| c|} % centered columns (4 columns)
\hline\hline                        %inserts double horizontal lines
\textbf{Atributo} & \textbf{Descripción} & \textbf{Tipo} & \textbf{Nulo} & \textbf{Clave primaria}\\ [1ex] % inserts table 
%heading
\hline                  % inserts single horizontal line
Id & Identificador interno del objeto & INT & NO & SI \\ % inserting body of the table
\hline
Nombre & Nombre del cliente & VARCHAR(255) & NO & NO \\
\hline
Apellido1 & Primer apellido del cliente & VARCHAR(255) & NO & NO \\
\hline
Apellido2 & Segundo apellido del cliente & VARCHAR(255) & NO & NO \\
\hline
DIrección & Dirección donde reside el cliente & VARCHAR(255)  & NO & NO\\
\hline
Localidad & Localidad del cliente & VARCHAR(255)  & NO & NO\\
\hline
Provincia & Provincia del cliente & VARCHAR(255)  & NO & NO\\
\hline
Teléfono & Teléfono fijo del cliente & VARCHAR(9) & NO & NO\\
\hline
Móvil & Teléfono móvil del cliente & VARCHAR(9)  & NO & NO\\
\hline
Email & Dirección de correo del cliente & VARCHAR(255) & NO & NO\\
\hline %inserts single line
\end{tabular}
\label{Riesgos} % is used to refer this table in the text
\caption{Entidad:\textbf{ Cliente}} % title of Table
\end{table}
%\setlength{\floatsep}{0.6pt plus 0.6pt minus 0.6pt} 
\floatsep -0.2pt plus 0.2pt minus 0.2pt
\begin{table}[ht]
\centering  % used for centering table
\begin{tabular}{|c |c| c| c| c|} % centered columns (4 columns)
\hline\hline                        %inserts double horizontal lines
\textbf{Atributo} & \textbf{Descripción} & \textbf{Tipo} & \textbf{Nulo} & \textbf{Clave primaria}\\ [1ex] % inserts table 
%heading
\hline                  % inserts single horizontal line
Id & Identificador interno del objeto & INT & NO & SI \\ % inserting body of the table
\hline
Nombre & Nombre del cliente & VARCHAR(255) & NO & NO \\
\hline
Apellido1 & Primer apellido del cliente & VARCHAR(255) & NO & NO \\
\hline
Apellido2 & Segundo apellido del cliente & VARCHAR(255) & NO & NO \\
\hline
DIrección & Dirección donde reside el cliente & VARCHAR(255)  & NO & NO\\
\hline
Localidad & Localidad del cliente & VARCHAR(255)  & NO & NO\\
\hline
Provincia & Provincia del cliente & VARCHAR(255)  & NO & NO\\
\hline
Teléfono & Teléfono fijo del cliente & VARCHAR(9) & NO & NO\\
\hline
Móvil & Teléfono móvil del cliente & VARCHAR(9)  & NO & NO\\
\hline
Email & Dirección de correo del cliente & VARCHAR(255) & NO & NO\\
\hline %inserts single line
\end{tabular}
\label{Riesgos} % is used to refer this table in the text
\caption{Entidad:\textbf{ Cliente}} % title of Table
\end{table}
\floatsep -0.2pt plus 0.2pt minus 0.2pt
\begin{table}[ht]
\centering  % used for centering table
\begin{tabular}{|c |c| c| c| c|} % centered columns (4 columns)
\hline\hline                        %inserts double horizontal lines
\textbf{Atributo} & \textbf{Descripción} & \textbf{Tipo} & \textbf{Nulo} & \textbf{Clave primaria}\\ [1ex] % inserts table 
%heading
\hline                  % inserts single horizontal line
Id & Identificador interno del objeto & INT & NO & SI \\ % inserting body of the table
\hline
Nombre & Nombre del cliente & VARCHAR(255) & NO & NO \\
\hline
Apellido1 & Primer apellido del cliente & VARCHAR(255) & NO & NO \\
\hline
Apellido2 & Segundo apellido del cliente & VARCHAR(255) & NO & NO \\
\hline
DIrección & Dirección donde reside el cliente & VARCHAR(255)  & NO & NO\\
\hline %inserts single line
\end{tabular}
\label{Riesgos} % is used to refer this table in the text
\caption{Entidad:\textbf{ Cliente}} % title of Table
\end{table}
share|improve this question

migrated from stackoverflow.com Dec 7 '12 at 7:26

This question came from our site for professional and enthusiast programmers.

    
    
Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Dec 7 '12 at 16:44
add comment

1 Answer 1

If you wish to keep the contents together, put it in the same float environment. Yes, you can have more than one \caption and \label inside the float. The float container is only a box that can move around inside your document. So, use

\begin{table}[p]
  \centering
  \begin{tabular}...\end{tabular}
  \caption[..]{...}\label{table1}
  \bigskip% Space between tabulars
  \begin{tabular}...\end{tabular}
  \caption[..]{...}\label{table2}
  \bigskip% Space between tabulars
  \begin{tabular}...\end{tabular}
  \caption[..]{...}\label{table3}
\end{table}

\bigskip provides a space between the tabulars, although you can also use \vspace{<len>} if you wish.

Note that you need to use different labels (as I did in my example) in order to reference the tables correctly.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.