Graphics, Figures & TablesTop alignment for tabulars in minipage

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
andreas_baldur
Posts: 2
Joined: Tue Apr 12, 2011 11:11 am

Top alignment for tabulars in minipage

Post by andreas_baldur »

Hello out there. I simply cant get top alignment working correct, when i insert a caption in the table tag.
My wish is, to have one caption to cover both tabulars -> therefore placing caption in table tag. But when i do that, that topalignment crashes.

Only if i insert the caption within the minipage, so that both tabulars will get a caption, the top alignment works fine.
alignment-bad.png
alignment-bad.png (123.97 KiB) Viewed 1495 times
alignment-good.png
alignment-good.png (100.08 KiB) Viewed 1495 times
My code for the table is:
\begin{table}[htbp] %hb
\caption{Caption in table tag}
\begin{minipage}[t]{0.5\linewidth}
\caption{caption within minipage}
\centering

\hspace{-4cm}
\begin{tabular}{>{\hfill}p{3.5cm} p{3.3cm}}
\toprule
\multicolumn{2}{c}{\textbf{Lokalt (USB, SD, MMC})}\\
{\textit{Fordele}} & {\textit{Ulemper}} \\[1ex]\hline \\ [-1.5ex]
USB-overførselshastigheden er typisk højere end internet-overførsel. & Større sandsynlighed for at dataene går tabt. \\
[1ex] \hline \\ [-1.5ex]
Nemt at tilgå data. & Langsomt at tilgå data \\ [1ex] \hline \\ [-1.5ex]
Ved at lagre lokalt undgår man afhængigheden af 3G eller GPRS mobilnet forbindelse. & Opbevaring af data foregår fysisk. \\[1ex] \hline \\ [-1.5ex]
Prisen på hukommelseskort er med tiden blevet billig. & Der kræves et stykke software til sortering af data. \\ [1ex] \bottomrule \\ [-1.5ex]
\end{tabular}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[t]{0.5\linewidth}
\centering
\caption{caption within minipage}
\hspace{-2cm}
\begin{tabular}{>{\hfill}p{3.4cm} p{3.4cm}}
\toprule
\multicolumn{2}{c}{\textbf{Online (Internetbaseret)})}\\
{\textit{Fordele}} & {\textit{Ulemper}} \\[1ex]\hline \\ [-1.5ex]
Data kan tilgås overalt med internetadgang. & Kræver internetforbindelse. \\
[1ex] \hline \\ [-1.5ex]
Nemt at bearbejde data. Databearbejdning kan foregå i web-baserede sprog og blive vist direkte i html. & Kræver ekstern server til opbevaring af data i database. \\ [1ex] \hline \\ [-1.5ex]
Regelmæssig dataoverførsel reducerer risiko for tab af data, enten ved tyveri eller hvis produktet får fysiske skader. & GSM/GPRS modul er relativt dyrt. \\[1ex] \hline \\ [-1.5ex]
Al dataoverførsel foregår automatisk (sparer tid). & \\ [1ex] \bottomrule \\ [-1.5ex]
\end{tabular}
\end{minipage}
\end{table}

Hope u can give me answers :)
Best, Andreas

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply