1

I have a table and figure that I need them to appear side-by-side. The figure appears in a higher position than the table. I need to align them so that their sizes are equivalent. This is the script and the output compared to what I need.

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{graphicx}
\begin{document}
\begin{minipage}{\textwidth}
\begin{minipage}[b]{0.49\textwidth}
\centering 
\captionof{table}{Table}
\begin{tabular}{ll}
\hline\noalign{\smallskip}
Item1 & Item2 \\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
C & 100  \\
B & 200  \\
C & 300 \\
\hline
\end{tabular}
\end{minipage}
\hfill
\begin{minipage}[b]{0.49\textwidth}
\centering
\includegraphics[width=0.5\textwidth]{venndiagram2}
\captionof{figure}{Diagram.}
\end{minipage}
\end{minipage}
\end{document}

enter image description here

0

1 Answer 1

1

enter image description here

  • outer minipage is surplus
  • both inner minipages pages have proper position options [b]
  • to table you need add position option [b]
  • with booktabs you can obtain simpler code for horizontal lines in table

MWE:

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage[demo]{graphicx}
\usepackage{booktabs}

\begin{document}
    \begin{minipage}[b]{0.49\textwidth}
    \centering
\captionof{table}{Table}
\begin{tabular}[b]{ll}
    \toprule    %[0.3pt] 
Item1 & Item2 \\
    \midrule    %[0.3pt]
\noalign{\smallskip}
C & 100  \\
B & 200  \\
C & 300 \\
    \bottomrule %[0.3pt]
\end{tabular}
\end{minipage}
\hfill
\begin{minipage}[b]{0.49\textwidth}
    \centering
\includegraphics[width=0.5\textwidth]{venndiagram2}
\captionof{figure}{Diagram.}
    \end{minipage}
\end{document}

Not the answer you're looking for? Browse other questions tagged .