I want to place a figure next to a table. To do so, I use the minipage environment. Here's the MWE:
\documentclass{article}
\usepackage{caption}
\begin{document}
{\centering
\begin{minipage}[t]{0.45\textwidth}
\centering
\rule{4cm}{2cm} %to simulate an actual figure
\captionof{figure}{Figure caption}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\centering
\begin{tabular}[t]{lccc}
\hline
Parameter & Symbol & Value & Unit \\
\hline
XXX & abc & XXX & $\mathrm{m}^2$ \\
XXX & abc & XXX & $\mathrm{m}^2$ \\
XXX & abc & XXX & kg \\
XXX & abc & XXX & $\mathrm{N}/\mathrm{m}$ \\
XXX & abc & XXX & $\mathrm{N}$ \\
\hline
\end{tabular}
\captionof{table}{Table caption}
\end{minipage}
}
\end{document}
I have not yet found a means to achieve identical alignment vertically for the caption of the figure and the table, respectively. Also, is there any way to center the table vertically on its minipage? Thanks in advance, any help is highly appreciated!
Best Answer
Solution suggested in comment works if captions have only one line of text. Better is instead of
minipages
to usetabularx
andadjusbox
as follows:Addendum: To have picture and table vertical centered and the same time vertical aligned their captions at the top, as in figure below, you need two rows in
tabularx
and change their options which determine their baseline (vertical position in table):