0

In one of my documents, I am attempting to put have a table inside of a figure environment, and have one caption that refers to both of the above (I am trying to have the table act as a separate panel). I haven't been able to make this work however.

I am going to borrow code from another question that was asked here before, since I think it would do essentially what I want to do. However, if someone knows how to a) have the "combined figure" span two columns (which I think is just a matter of adding a star inside {figure}) and b) have the image and table widths automatically span the width of the two columns, that would be great.

The code that I'm referring to is Zarko's answer here How to add a table below a figure in \figure environment

Thanks!

2
  • 1
    Regarding a): Use figure* instead of figure. Regarding b): Replace \columnwidth by \textwidth
    – leandriis
    Commented Nov 10, 2018 at 17:54
  • Perfect - thank you @leandriis. How do I give you a checkmark?
    – rpickmans
    Commented Nov 11, 2018 at 16:38

1 Answer 1

2

In order to obtain a figure that uses the width of both columns in a twocolumn document, use figure* instad of figure. In order to make the table and image as wide as the textwidth, replace \columnwidth by \textwidth.

\documentclass[twocolumn]{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\usepackage{tabularx}
\usepackage{lipsum}


\begin{document}
\begin{figure*}[ht]
    \centering
    \begin{subfigure}{.7\textwidth}
        \includegraphics[width=\linewidth]{example-image}
    \caption{picture}
    \end{subfigure}

    \bigskip
    \begin{subfigure}{\textwidth}
        \centering
        \renewcommand\tabularxcolumn[1]{m{#1}}
        \renewcommand\arraystretch{1.3}
        \setlength\tabcolsep{2pt}
    \begin{tabularx}{\linewidth}{*{4}{>{\centering\arraybackslash}X}}
    \hline
\textbf{Links} & \textbf{Scenario 1} & \textbf{Scenario 2} & \textbf{Scenario 3}  \\
      ???      &    (tree)           &    (Graph)          &  (Matrix)            \\ 
    \hline
    \end{tabularx}
        \caption{table}
    \end{subfigure}
\caption{Some wonderful words.}
    \label{my label}
\end{figure*}
\lipsum \lipsum
\end{document}

enter image description here

You must log in to answer this question.

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