Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

To save space, I would like to place the following table next to each other. Each has a separate caption. I have this,

enter image description here

I want this,

enter image description here

Sample code,

\documentclass[]{memoir}
\usepackage[utf8x]{inputenc}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{algorithmic}
\usepackage{algorithmicthesis}

\begin{document}

\begin{figure}
\centering
\includegraphics[scale=0.2]{figure.png}
\caption{This is the caption for figure}
\end{figure}
\begin{table}
\centering
\caption{This is the caption for table}
\begin{tabular}{cc}
1 & Item 1 \\
3 & Item 2 \\
4 & Item 3 \\
5 & Item 4 \\
5 & Item 5 \\
\end{tabular}
\end{table}

\end{document}

The solution mentioned here doesn’t allow two captions.

share|improve this question
    
And another possible duplicate: tex.stackexchange.com/q/62282/21591 . –  mafp Mar 19 '13 at 11:00
add comment

marked as duplicate by mafp, zeroth, Andrew Swann, diabonas, lockstep Mar 19 '13 at 11:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers

up vote 5 down vote accepted

The capt-of package provides the right solution with \captionof. Also caption provides it, but this package is not recommended with memoir; on the contrary, the trick performed by capt-of is compatible with this class.

\documentclass{memoir}
\usepackage[demo]{graphicx} % the demo option is just for the example
\usepackage{capt-of}

\begin{document}

\begin{figure}
\centering
\begin{minipage}[t]{.4\textwidth}
\centering
\vspace{0pt}
\includegraphics[width=\textwidth]{figure.png}
\caption{This is the caption for figure}
\end{minipage}\hfill
\begin{minipage}[t]{.4\textwidth}
\centering
\vspace{0pt}
\captionof{table}{This is the caption for table}
\begin{tabular}{cc}
1 & Item 1 \\
3 & Item 2 \\
4 & Item 3 \\
5 & Item 4 \\
5 & Item 5 \\
\end{tabular}
\end{minipage}
\end{figure}

\end{document}

The \vspace{0pt} commands are to ensure top alignment. Dispose of them as you wish.

enter image description here

share|improve this answer
    
Thanks. This works. \hspace{} can be used instead of \file to fine tune space between columns. –  entropy Mar 19 '13 at 11:14
    
I didn't even know that the capt-of package exists but that was I was looking for. :) –  hpesoj626 Mar 19 '13 at 12:40
add comment

I agree with your comment, egreg. Now I adjunt an elaborate example:

\begin{figure}[htbp]\RawFloats
\begin{minipage}{0.65\textwidth}
\centering
\includegraphics[scale=0.75]{figure.pdf}
\captionof{figure}{caption of figure\label{fig06-42a}}
\end{minipage}

\quad
\begin{minipage}{0.25\textwidth}
\begin{center}
\captionof{table}{caption of table}\label{tab3}
\vspace{6pt}
\begin{tabular}{c c}
\hline
\rule[-8pt]{0pt}{22pt}$M$& \hspace{20pt}$10 \log_{10}R_{M}$  \\
\hline
\rule{0pt}{14pt}8&\hspace{20pt} 1,65 \\
16&\hspace{20pt} 4,20 \\
32&\hspace{20pt} 7,02 \\
64&\hspace{20pt} 9,95 \\
\hline
\end{tabular}
\end{center}
\end{minipage} 
\end{figure} 
share|improve this answer
    
@hpsoj626 Thanks for your edition. –  jpayansomet Mar 19 '13 at 12:56
add comment

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