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'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}
share|improve this question
2  
2  
Use \begin{table}[htb] for both tables. –  Harish Kumar Jun 11 at 13:16
1  
Also related: tex.stackexchange.com/questions/2275/… –  Torbjørn T. Jun 11 at 16:09

1 Answer 1

up vote 9 down vote accepted

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.

share|improve this answer
    
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... dropbox.com/s/hxsidpz23ipmfbg/place.zip –  Mika Ike Jun 12 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 at 12:22

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.