[Tex/LaTex] Image and table side by side

floatsgraphicsminipagetables

I want to put a table and a figure side-by-side. The table should fill two third of the text width, and the figure the last third.

So I'd like to achieve one of the following effects (which are equivalent in my case):

  • One table with 3 columns. The first two columns contain text, the third column contains a lengthy image. The height of the image should be determined by the height of the whole table, if that's possible

  • Or, a divided page like in newspapers. On the left side I have the table, on the right side the image.

What I have tried:

\begin{multicols}{2}
\begin{tabular}{ l l }
Text & Text \\
Text & Text \\
... & ... \\
\end{tabular}
\vfill
\begin{figure}[H]
    \includegraphics[]{images/image}
\end{figure}
\end{multicols}

But this places the picture directly on top of the table.

I also tried using \usepackage[export]{adjustbox} and \includegraphics[right]{images/image} but the caption is still in the center of the page and therefor on top of the table.

Best Answer

What about this?

enter image description here

It uses two minipages (with respectively a width of 60% and 30% of \textwidth (so that it remains a 10% margin)) that are embedded in a figure environment in order to make it "float". (You could also use another minipage, or nothing at all.)

The two minipages are vertically centered the one relatively to the other (cf. their [c] argument).

The array (I used tabularx in order to show you its width) use the relative length \linewidth in order to define its width: indeed, it must use all the line width of the minipage it is embedded in. Like this, you only have to care about minipages widths.).
Idem to the picture.

Both minipages are separated with the gutter \hfill that insert an horizontal "spring" between them.


MWE:

\documentclass{scrartcl}
    \usepackage{array,multicol,booktabs,tabularx}
    \usepackage{graphicx}
    \usepackage{showframe}

\begin{document}
\begin{figure}[h]
    \begin{minipage}[c]{.6\textwidth}% or {.6\linewidth}, it's the same here
        \begin{tabularx}{\linewidth}{lX}% caution: here you cannot replace \linewidth by \textwidth, since within this minipage, \linewidth=.6\textwidth
            \toprule
                Text & Text 
            \\\midrule
                Text & Text 
            \\
                \dots & \dots 
            \\\bottomrule
        \end{tabularx}
    \end{minipage}
    \hfill
    \begin{minipage}[c]{.3\textwidth}
        \includegraphics[width=\linewidth]{example-image}% caution: here you cannot replace \linewidth by \textwidth, since within this minipage, \linewidth=.3\textwidth
    \end{minipage}
\end{figure}      
\end{document}