2

I'm trying to learn how to typeset caption tables but... why doesn't this text appear between tables? enter image description here

\documentclass{article}
\usepackage{subcaption}
\begin{document}

\begin{table}
\begin{subtable}{.5\linewidth}\centering
{\begin{tabular}{ccc}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\caption{A subtable}\label{tab:1a}
\end{subtable}%
%
\begin{subtable}{.5\linewidth}\centering
{\begin{tabular}{c c c}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\caption{Another subtable}\label{tab:1b}
\end{subtable}
\caption{A table}\label{tab:1}
\end{table}

 Why is not this text between the tables?


\begin{table}
\begin{subtable}{.5\linewidth}\centering
{\begin{tabular}{ccc}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\caption{A subtable}\label{tab:1a}
\end{subtable}%
%
\begin{subtable}{.5\linewidth}\centering
{\begin{tabular}{c c c}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\caption{Another subtable}\label{tab:1b}
\end{subtable}
\caption{A table}\label{tab:1}
\end{table}



\end{document}
jub0bs
  • 58,916
Mika Ike
  • 3,751

1 Answers1

9

You do not need a table environment to make a table, you can just use tabular directly (just as you do not need figure to include an image, that is done with \includegraphicics)

The only point of figure and table is that they are floats which means that they can be moved by the system to help with page breaking. In the comments it has been suggested to include h in the float position arguments which gives the possibility of the float being placed "here" and not being moved, but even if it happens not to move you should not write the surrounding text assuming that as any edit to the document can change the page breaking decisions.

That is why you should put a referencable caption in a floating environment and refer to it by reference without assuming it is typeset in place.

David Carlisle
  • 757,742
  • thank you very much. Yesterday i understood but today I´m trying and have aline at the final .tex that don´t appear where I want, and I can´t understand. Could you tell me why?. Is a little large to post directly here, so... https://www.dropbox.com/s/hxsidpz23ipmfbg/place.zip – Mika Ike Jun 12 '14 at 11:38
  • @MikaIke sorry not fetching zip files:-) try to make a small example of the problem and ask a new question. – David Carlisle Jun 12 '14 at 12:22