\begin{figure}[htbp]
\centering
\makebox[0.5\textwidth]{\includegraphics[width=0.7\textwidth]{figure/ch3/result_s2/book.jpg}}
\qquad \qquad
\scalebox{0.7}{
\begin{tabular}[c]{cc}
\hline
\textbf{Method} & \textbf{$\sigma$} \\ \hline
method 1 & 0.0 \\
method 2 & 0.1 \\
method 3 & 0.2 \\ \hline
\end{tabular}}
\end{figure}
请帮忙!谢谢
答案1
像这样吗?
代码:
\documentclass{article}
\usepackage{graphicx}
\usepackage[active,floats,tightpage]{preview}
\setlength\PreviewBorder{5mm}
\begin{document}
\begin{figure}
\centering
\raisebox{-13mm}{
\includegraphics[width=0.5\textwidth]{example-image}
}
\hfil
\begin{tabular}[b]{cc}
\hline
\textbf{Method} & \textbf{$\sigma$} \\ \hline
method 1 & 0.0 \\
method 2 & 0.1 \\
method 3 & 0.2 \\ \hline
\end{tabular}
\caption{May figure accompanied with table}
\end{figure}
\end{document}
对于垂直居中我使用\raisebox
。图形降低的量需要根据原始图片的大小来选择。
答案2
使用\raisebox{-0.5\height}{...}
,这样图像就会垂直居中,而不需要猜测其高度。
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[htbp]
\centering
\raisebox{-.5\height}{%
\includegraphics[width=0.7\textwidth]{example-image}%
}\hfill
{\footnotesize
\begin{tabular}[c]{cc}
\hline
\textbf{Method} & \textbf{$\sigma$} \\ \hline
method 1 & 0.0 \\
method 2 & 0.1 \\
method 3 & 0.2 \\ \hline
\end{tabular}}
\end{figure}
\end{document}
\scalebox
在这种情况下要避免:选择\footnotesize
更好。