Graphics, Figures & Tables ⇒ Centering caption in \minipage
Centering caption in \minipage
Can someone help me with centering the caption of each of the tables.
Thanking you,
Mehrzad
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Centering caption in \minipage
Have you tried switching the order of the environment. Meaning,
Code: Select all
\begin{minipage}[b]{0.5\linewidth}
\begin{table}[ht]
\centering
\begin{tabular}{|c|c|c|}
\hline
1&1&1\\
\hline
2&2&2\\
\hline
\end{tabular}
\end{table}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.5\linewidth}
\begin{table}[ht]
\centering
\begin{tabular}{|c|c|c|}
\hline
1&1&1\\
\hline
2&2&2\\
\hline
\end{tabular}
\end{table}
\end{minipage}
Cheers
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Centering caption in \minipage
There's nothing unusual in this method. Some well known packages internally exactly proceed this way.fatra2 wrote:[...] I just find it very peculiar to enter a minipage environment inside a table. [...]
I can't see the problem. The method of your reference works fine.i.mehrzad wrote:I have looked all over the net for this. I have two tables side by side and have done this using the minipage argument. The problem is that the caption for the tables are not center aligned. [...]
Code: Select all
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs}
\begin{document}
\begin{table}[!ht]
\begin{minipage}[t]{0.5\linewidth}
\caption{default}\label{tab:table1}
\centering
\begin{tabular}{cc}\toprule
Table head & Table head \\ \midrule
Some values & Some values \\
Some values & Some values \\
Some values & Some values \\ \bottomrule
\end{tabular}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[t]{0.5\linewidth}
\caption{default}\label{fig:table2}
\centering
\begin{tabular}{cc}\toprule
Table head & Table head \\ \midrule
Some values & Some values \\
Some values & Some values \\
Some values & Some values \\ \bottomrule
\end{tabular}
\end{minipage}
\end{table}
\end{document}
Best regards
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10