I am still kinda new to LaTeX so perhaps I am overlooking something. But I wonder why I cannot use the [t] after \begin{table}
to align it to the top of the minipage.
I included the \usepackage{float}
in my predocument.
I hope someone can help me. Thx in advance.
\begin{minipage}{0.6\textwidth}
\begin{table}[H]
\begin{center}
\caption{Messwerte für Kalibrierung}
\label{Tabelle 1}
\begin{tabular}{ |C{2cm} |C{2.3cm} |C{2.3cm}|}
\hline
Kalibrationsreihe & Transmission & Konzentration [in $\frac{mg}{L}$]
\\\hline
K1 & 0,059 & 1 \\
K2 & 0,323 & 5 \\
K3 & 0,648 & 10 \\
K4 & 0,96 & 15 \\
K5 & 1,211 & 20 \\
\hline
\end{tabular}
\end{center}
\end{table}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\begin{table}[t]
\begin{center}
\caption{Probe und Referenz}
\label{Tabelle 2}
\begin{tabular}{|c|c|}
\hline
Probe & Transmission
\\\hline
P1 & 1,032 \\
P2 & 1,037 \\\hline
R & 0,955 \\
\hline
\end{tabular}
\end{center}
\end{table}
\end{minipage}
The [t]
after table
has nothing to do with the alignment. It is a floating specifier which specifies the position a floating object can be placed on a page, e.g. the top of the page in case of [t]
.
If you want your table at a specific location, e.g. besides each other, don't put them in a floating environment like a table
. Instead you can use the \captionof
macro from the caption package.
To change the alignment, you can use the optional argument of the minipage
to e.g. choose [t]
op alignment.
Some other points:
Your minipages have a combined width of 1\textwidth
. If you want them side by side, you must remove the indention before them and protect your line endings with %
, otherwise they will add an additional space
the center
environment adds additional vertical spacing. Use \centering
instead
by default the ,
in your numbers will result to incorrect spacing around it. If you want to use ,
as decimal separator, either use the icomma
package or have a look at siunitx
to properly format your numbers
\documentclass{article}
\usepackage{float}
\usepackage{caption}
\usepackage{geometry}
\usepackage{array}
\newcolumntype{C}[1]{p{#1}}
\usepackage{icomma}
\begin{document}
\noindent\begin{minipage}[t]{0.6\textwidth}%
\centering
\captionof{table}{Messwerte für Kalibrierung}
\label{Tabelle 1}
\begin{tabular}{ |C{2cm} |C{2.3cm} |C{2.3cm}|}
\hline
Kalibrations\-reihe & Transmission & Konzentration [in $\frac{mg}{L}$]
\\\hline
K1 & 0,059 & 1 \\
K2 & 0,323 & 5 \\
K3 & 0,648 & 10 \\
K4 & 0,96 & 15 \\
K5 & 1,211 & 20 \\
\hline
\end{tabular}
\end{minipage}%
\begin{minipage}[t]{0.4\textwidth}%
\centering
\captionof{table}{Probe und Referenz}
\label{Tabelle 2}
\begin{tabular}{|c|c|}
\hline
Probe & Transmission
\\\hline
P1 & 1,032 \\
P2 & 1,037 \\\hline
R & 0,955 \\
\hline
\end{tabular}
\end{minipage}%
\end{document}