我有一个如下的图形设置:
\begin{figure*}[t!]
\centering
\subfigure[Part 1]
{
\includegraphics*[totalheight=2in,origin=c]{ost100}
}
\subfigure[Part 2]
{
\includegraphics*[totalheight=2in,origin=c]{bay}
}
\subfigure[Part 3]
{
\small
\begin{tabular}{| l | c | r | r | } \hline
{...}
\hline
\end{tabular}
}
\caption{The main experiment.\label{f:main}}
\end{figure*}
由于某种原因,我的表格最终移到了第 1 部分和第 2 部分中的图像下方很远的地方,上面有大约 1/2 英寸的边距。缩小图像并不能改变这种情况。知道出了什么问题以及如何修复它吗?
答案1
这tabular
环境接受一个可选参数,用于根据当前行进行对齐。
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[includeheadfoot,margin=2cm]{geometry}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure*}[!ht]
\centering
\subfloat[Part 1]{%
\includegraphics*[totalheight=1in,origin=c]{ost100}
}
\subfloat[Part 2]{%
\includegraphics*[totalheight=1in,origin=c]{bay}
}
\subfloat[Part 3]{%
\small
\begin{tabular}[b]{|l|r|} \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 \\ \hline
\end{tabular}
}
\caption{The main experiment.}\label{fig:main}
\end{figure*}
\end{document}
demo
因为您的图形文件不存在,所以需要使用 graphicx 包选项。稍后再删除它。
答案2
\documentclass[a4paper]{article}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure*}[!ht]
\centering
\subfloat[Part 1]{\includegraphics*[width=0.3\linewidth]{ost100}}\hfill
\subfloat[Part 2]{\includegraphics*[width=0.3\linewidth]{bay}} \hfill
\subfloat[Part 3]{\small
\begin{tabular}[b]{| l | c | r | r | } \hline
foo&bar&baz&foo \\\hline
foo&bar&baz&foo \\\hline
foo&bar&baz&foo \\\hline
\end{tabular}}
\caption{The main experiment.\label{f:main}}
\end{figure*}
\end{document}