1

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.

  • 1
    Could you give a bit more info on the context in which you'll use it? There are plenty of ways to achieve it. However, some solutions might be more or less adequate to your needs. Is it a "one-shot" feature? Is it for a whole document? Is your table really an array, or is it just a way to display some text? – ebosi Jul 8 '16 at 13:51
  • Hey, thanks for the reply. I only want to use this once. The table is really an array. – Jdv Jul 8 '16 at 13:54
1

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}
  • Thats works perfectly fine, thank you very much! – Jdv Jul 8 '16 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.