为了节省空间,我想将下表并排放置。每个表格都有单独的标题。我有这个,
我要这个,
示例代码,
\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}
提到的解决方案这里不允许有两个标题。
答案1
包capt-of
中提供了正确的解决方案\captionof
。也 caption
提供了它,但是不建议将此包与一起使用memoir
;相反,执行的技巧capt-of
与此类兼容。
\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}
这些\vspace{0pt}
命令是为了确保顶部对齐。您可以根据需要处理它们。
答案2
我同意你的评论,egreg。现在我附上一个详细的例子:
\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}