2

I want to have a plot and a table side by side which can be solved using the subfig package. However I'd like the table to appear in the list of tables and not in the list of figures. Is there a way to do this?

\documentclass[a4paper,11pt,titlepage]{article}

\usepackage{subfig}% http://ctan.org/pkg/subfig
\setcounter{lofdepth}{2} % we want subfigures in the list of figures

\begin{document}

\listoffigures
\listoftables

\begin{figure}[h]
    \centering
    \subfloat[text for list of figures][A figure left of a table]{
        \rule{6.4cm}{3.35cm}
    }
    \subfloat[text for list of tables][A table right of a figure]{
        \begin{tabular}[b]{cc}\hline
            Table head & Table head \\ \hline
            Some values & Some values \\
            Some values & Some values \\
            Some values & Some values \\
            Some values & Some values \\
            Some values & Some values \\
            Some values & Some values \\ \hline
        \end{tabular}
    }
    \caption{A figure and a table, side-by-side}
\end{figure}

\end{document}

The result looks like this:

enter image description here

  • Are you sure you want subfloat here?? what number do you want on the table? table 1b doesn't make much sense as a first table. Just use a top level float and \captionof{figure}{fig caption} and \captionof{table}{table caption} \captionof from caption or capt-of packages – David Carlisle Jun 25 '14 at 11:55
  • Also standard comment: Don't use [h] use [htp] – David Carlisle Jun 25 '14 at 11:56
  • Thanks a lot for the comments!!! @ David I'm new to latex and I have used subfloat simply because it came closest to my wish. Is there an example that uses your idea that you could link to? Or if you have the time, could you provide an example? How could I achieve horizontal alignment this way? – Joz Jun 25 '14 at 12:08
3

As with any method of binding a figure and table together, beware that latex will not preserve the table order here, this float will float in sequence with figures so if you have another table environment it may float past this causing your tables to be out of sequence, in which case you would need to move the table in the source file to regain the correct numbering.

\documentclass[a4paper,11pt,titlepage]{article}

\usepackage{capt-of}
\begin{document}

\listoffigures
\listoftables

\begin{figure}[htbp]
    \centering
\begin{minipage}{.55\textwidth}
        \rule{6.4cm}{3.35cm}

\captionof{figure}[text for list of figures]{A figure left of a table}
\end{minipage}\hfill
\begin{minipage}{.4\textwidth}

        \begin{tabular}[b]{cc}\hline
            Table head & Table head \\ \hline
            Some values & Some values \\
            Some values & Some values \\
            Some values & Some values \\
            Some values & Some values \\
            Some values & Some values \\
            Some values & Some values \\ \hline
        \end{tabular}

\captionof{table}[text for list of tables]{A table right of a figure}
\end{minipage}
\end{figure}

\end{document}
  • Thanks a lot!!! I can't yet vote up. But the answer is exactly what I was looking for. – Joz Jun 25 '14 at 12:12

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.