[Tex/LaTex] Two tables in one line, problem with text between tables

tables

i have few problems.
1) I would like to create one table and inside 2 tabulators one on the left and one on the right with one caption, but when i use 2x tabular inside table i'm getting two tables on under the second one.
2) The second is table is putting on next page (i'm using !htbp arguments) but when i would like to write something under the table all i'm getting is text over the tables on previous page. How can i change it. (i have page with text on the end of page is few lines free and the tables are throw on new page, when i'm want write something under tables i'm getting text on first page in these free few line.)

Here is a code :
http://pastebin.com/P6r79MAP
I need to get 4 point under tables (but that not happening) and two tabulators in one line

Best Answer

@Hadson, Code in your link is far from a MWE ... Anyway, you have two problems:

  1. you request from tables (with empty line between them) to be each in new line
  2. second tables are to wide to both fits in one line in text width.

For show what I do, I made from your code the following MWE:

\documentclass[a4paper,titlepage,10pt]{article}
\usepackage[polish]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{caption}

\usepackage{makecell}% <-- new
\renewcommand{\arraystretch}{1}

    \begin{document}
\begin{table}[!htbp]
\caption{Pomiar masy i długości}
    \begin{tabular}[t]{|c|c|c|} \hline
    \multicolumn{3}{|c|}{Pręt} \\ \hline
     & wartość & niepewność \\ \hline
     m[g] & 685 & 1 \\ \hline
     l[mm] & 746 & 1 \\ \hline
     b[mm] & 97 & 1 \\ \hline
     a[mm] & 276 & 1 \\ \hline
    \end{tabular}
\quad
     \begin{tabular}[t]{|c|c|c|} \hline
    \multicolumn{3}{|c|}{Pierścień} \\ \hline
     & wartość & niepewność \\ \hline
     m[g] & 685 & 1 \\ \hline
     $D_{w}$[mm] & 74,6 & 1 \\ \hline
     $D_{z}[mm]$ & 97 & 1 \\ \hline
     $R_{z}[mm]$ & 276 & 1 \\ \hline
     e[mm] & 11 & 0,05 \\ \hline
     a[mm] &13.5 & 1,05 \\ \hline
    \end{tabular}
\end{table}

\begin{table}[!htbp]
\caption{Pomiar okresu drań}
    \begin{tabular}[t]{|c|c|c|c|} \hline
    \multicolumn{4}{|c|}{Pręt} \\ \hline
    Lp.
     &   \thead{Liczba\\ okresów k}
         &    \thead{Czas t[s]\\ dla k okresów}
             &  Okres $T_{i}[s]$ \\ \hline
    1 & 30 & 39.32 & 1.310 \\ \hline
    2 & 30 & 39.16 & 1.305 \\ \hline
    3 & 30 & 39.57 & 1.319 \\ \hline
    4 & 30 & 38.91 & 1.297 \\ \hline
    5 & 30 & 39.39 & 1.312 \\ \hline
    6 & 30 & 39.16 & 1.304 \\ \hline
    7 & 30 & 40.02 & 1.334 \\ \hline
    8 & 30 & 39.27 & 1.309 \\ \hline
    9 & 30 & 38.97 & 1.299 \\ \hline
    10 & 30 & 39.44 & 1.314 \\ \hline
    \multicolumn{4}{|l|}{Wartość średnia okresu $1.3103$} \\ \hline
    \multicolumn{4}{|l|}{Niepewność  $u(t): 3.38 * 10^{-3}$} \\ \hline
    \end{tabular}
\quad    
    \begin{tabular}[t]{|c|c|c|c|} \hline
    \multicolumn{4}{|c|}{Pręt} \\ \hline
    Lp.
     &   \thead{Liczba\\ okresów k}
         &    \thead{Czas t[s]\\ dla k okresów}
             &  Okres $T_{i}[s]$ \\ \hline
    1 & 30 & 30.68 & 1.023 \\ \hline
    2 & 30 & 30.75 & 1.025 \\ \hline
    3 & 30 & 30.87 & 1.029 \\ \hline
    4 & 40 & 40.93 & 1.023 \\ \hline
    5 & 40 & 40.81 & 1.020 \\ \hline
    6 & 30 & 30.52 & 1.017 \\ \hline
    7 & 30 & 31.02 & 1.034 \\ \hline
    8 & 40 & 41.11 & 1.028 \\ \hline
    9 & 40 & 40.57 & 1.014 \\ \hline
    10 & 30 & 30.65 & 1.022 \\ \hline
    \multicolumn{4}{|l|}{Wartość średnia okresu $T: 1.0235$} \\ \hline
    \multicolumn{4}{|l|}{Niepewność  $u(t): 3.38 * 10^{-3}$} \\ \hline
    \end{tabular}
\end{table}
    \end{document}

For first two table it was enough to erase empy line between the. For quick test I made distance between them with quad. Instead it you can use hfill associated with \centeringcommand after \begin{table}.

For second two table was my suspect in comment right. They are to wide. So, you see how to make columns with heads Liczba okresów k and Czas t[s] dla k okresów narrower. One way to do this is typeset them in more lines as I do in above MWE: in preamble add package makecell and then use its macro thead.

As you can see, I add to tables option [t] for aligning on top (since the first two are of different heights). Pictures of both tables after aforementioned suggestions:

enter image description here

Related Question