1

I want to place a table and an image side by side. I tried do this using minipage however I can't seem to find a way to align the top of the table with the top of the image. Below is my and my output:

\documentclass[a4paper, 11pt, letterpaper]{article}
\usepackage{fullpage} 
\usepackage{mathtools,amsthm}
\usepackage{tabularx}
\usepackage{graphicx,caption}
\usepackage{tabularx,booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

\begin{document}
\begin{minipage}{0.6\textwidth}
\begin{tabularx}{0.9\textwidth}{c|*{4}{Y}}
Quadrant & 1 & 2&3&4\\
\midrule
$\sin \theta $ & + &+&-&-\\
$\cos \theta$ &+&-&-&+\\
$\tan \theta$ &+&-&+&-
\end{tabularx}
\end{minipage}
\hfill
\begin{minipage}[t]{0.3\textwidth}
   \vspace{-2ex}
    \includegraphics[width= 0.7\textwidth]{sign.PNG}
    \captionof{figure}{Signs of $x-$ and $y-$ ordinates}
\end{minipage}
\end{document}

enter image description here

Also is there a way to automatically make the image and the table roughly the same size without manually trial and checking with the sizes?

Thanks for the help!

1 Answers1

3

To align the minipages at the top, you use the [t] option. To make this work correctly with an image, put a \vspace{0pt} in the beginning of the minipage (see here for an explanation).

And to make the figure with roughly the same height as the table, use \baselineskip multiplied by the number of table rows.

enter image description here

\documentclass[a4paper, 11pt, letterpaper]{article}
\usepackage{fullpage} 
\usepackage{mathtools,amsthm}
\usepackage{tabularx}
\usepackage{graphicx,caption}
\usepackage{tabularx,booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

\begin{document}
\begin{minipage}[t]{0.6\textwidth}
  \vspace{0pt}
  \begin{tabularx}{0.9\textwidth}{c|*{4}{Y}}
    Quadrant & 1 & 2&3&4\\
    \midrule
    $\sin \theta$ &+&+&-&-\\
    $\cos \theta$ &+&-&-&+\\
    $\tan \theta$ &+&-&+&-
  \end{tabularx}
\end{minipage}
\hfill
\begin{minipage}[t]{0.3\textwidth}
  \vspace{0pt}
  \includegraphics[height=4\baselineskip]{example-image}
  \captionof{figure}{Signs of $x-$ and $y-$ ordinates}
\end{minipage}
\end{document}