You can't use \toprule
outside of a tabular
environment.
Here's a way to get your table without \subfloat
, which is not useful here. I simply set the two tables inside an "overall" table for the purpose of \toprule
and \bottomrule
; setting explicit widths is time consuming because the width have to be computed in order not to get overfull boxes; I think that it's better letting TeX doing the work.
The two inner tables are set with the [t]
option to get them aligned at their tops.
\documentclass[a4paper,oneside,titlepage,draft]{scrbook}
\usepackage[T1]{fontenc} %Silbentrennung
\usepackage[utf8]{inputenc} % Umlaute
\usepackage[ngerman]{babel}
\usepackage{booktabs}
\usepackage{tabularx}
\newcommand{\mW}[2]{$\overline{#1}=#2$}
\newenvironment{mytable}[1][htb]
{\begin{table}[#1]\small}
{\end{table}}
\begin{document}
\begin{mytable}
\centering
\caption{Worms}
\begin{tabular}{@{}c@{}}% an "outside" table
\toprule
\begin{tabular}[t]{lrrrr}
Klasse & Zeit & y & x & Bez. \\
\midrule
0,0 - 2,1 & a, 16:45 & 0,0 & 1,0 & H1 \\
\mW{x}{1,1} & a, 16:56 & 5,0 & 0,5 & H2 \\
& a, 17:15 & 10,0 & 1,0 & H3 \\
& a, 17:37 & 15,0 & 2,1 & H4 \\
& b, 12:40 & 37,4 & 1,0 & H7 \\
\midrule
5,0 - 6,0 & a, 16:20 & 0,0 & 5,0 & I1 \\
\mW{x}{5,2} & a, 16:58 & 5,0 & 5,0 & I2 \\
& a, 17:19 & 10,0 & 6,0 & I3 \\
& b, 12:39 & 37,4 & 5,0 & I7 \\
\midrule
10,0 - 12,1 & a, 16:30 & 0,0 & 10,0 & J1 \\
\mW{x}{10,4}& a, 17:00 & 5,0 & 10,0 & J2 \\
& b, 12:44 & 31,0 & 10,0 & J6 \\
& b, 12:38 & 37,4 & 10,0 & J7 \\
\end{tabular}% <- REMOVE THIS % IF YOU WANT A SMALL SEPARATION BETWEEN THE TABLES
\begin{tabular}[t]{lrrrr}
Klasse & Zeitpunkt & y & x & Bez. \\
\midrule
15,0 - 17,1 & a, 16:32 & 0,0 & 15,0 & K1 \\
\mW{x}{15,7}& a, 17:04 & 5,0 & 15,0 & K2 \\
& a, 17:25 & 10,0 & 16,0 & K3 \\
& a, 17:49 & 15,0 & 17,1 & J4 \\
& b, 12:36 & 37,4 & 15,0 & K7 \\
& b, 08:24 & 37,4 & 16,5 & M7 \\
& b, 12:50 & 37,4 & 16,5 & M7 \\
\midrule
18,6 - 20,6 & a, 16:38 & 0,0 & 20,0 & L1 \\
\mW{x}{19,7}& b, 06:13 & 5,0 & 18,6 & M2 \\
& b, 11:05 & 5,0 & 18,6 & M2 \\
& a, 17:07 & 5,0 & 19,0 & L2 \\
& b, 06:17 & 7,5 & 20,2 & M3 \\
& b, 06:21 & 15,0 & 20,6 & M4 \\
& b, 06:25 & 23,1 & 20,3 & M5 \\
& b, 06:30 & 31,0 & 19,7 & M6 \\
\end{tabular}\\% end the "outside" table line
\bottomrule
\end{tabular}
\end{mytable}
\end{document}
Best Answer
If the
table
is placed on a page with some other text, it should be possible to place it at the top of the page block by starting it off as follows:If, on the other hand, the
table
is on a floats-only page -- which is, by definition, the case if it's the only item on the page -- your options depend on which document class is in use. Assuming it's one of the "standard" LaTeX document classes (article
,report
, orbook
) or a class that's based on one of these classes, you can achieve your objective by inserting the following lines of code in the preamble: