我有 6 个不同的图形subfloatA11
,subfloatA32
使用subfloat
,我想强制 Latex 自动将整个页面分配给这些图形,充分利用它们可以占用的空间,而不是像下面这样弄得一团糟:
\newcommand{\sfigbigbig}[0]{9.8cm}
\newcommand{\sfigbigwhole}[0]{14.5cm}
\newcommand{\sfigbig}[0]{7.0cm}
\newcommand{\sfigmedium}[0]{5cm}
\newcommand{\sfigmediumP}[0]{5cm}
\newcommand{\sfigsmall}[0]{2.0cm}
\newcommand{\sfigfullcol}[0]{\sfigbigbig}
%---
\usepackage{subfig}
\documentclass[prodmode,acmtaco]{acmsmall} % Aptara syntax
\begin{document}
\begin{figure}[t!]
\centering
\begin{tabular}{rr}
\hspace{-50pt}
\subfloat[subfloatA11]{\includegraphics[width = \sfigbigbig,height=0.35\textwidth]{figures/subfloatA01.eps}} &
\hspace{-30pt}
\subfloat[subfloatA12]{\includegraphics[width = \sfigbigbig,height=0.35\textwidth]{figures/subfloatA12].eps}} \\\
\hspace{-50pt}
\subfloat[subfloatA21]]{\includegraphics[width = \sfigbigbig,height=\sfigmedium]{figures/subfloatA22].eps}} &
\hspace{-30pt}
\subfloat[subfloatA22]{\includegraphics[width = \sfigbigbig,height=\sfigmediumP]{figures/subfloatA32.eps}} \\
\hspace{-50pt}
\subfloat[subfloatA31]{\includegraphics[width = \sfigbigbig,height=\sfigmedium]{figures/subfloatA31.eps}} &
\hspace{-30pt}
\subfloat[subfloatA32]{\includegraphics[width = \sfigbigbig,height=\sfigmediumP]{figures/subfloatA32.eps}}
\end{tabular}
\caption{Performance}
\label{fig:perf}
\end{figure}
答案1
9.8cm
不要为图表分配绝对宽度(例如),而是考虑分配相对宽度(例如) 0.475\textwidth
。
我会摆脱\hspace{-30pt}
和\hspace{-50pt}
声明。
\documentclass[prodmode,acmtaco]{acmsmall} % Aptara syntax
\usepackage{subfig}
\begin{document}
\begin{figure}[t!]
\subfloat[subfloatA11]{\includegraphics[width = 0.475\textwidth,
height=0.35\textwidth]{figures/subfloatA01.eps}}
\hspace*{\fill} % horizontal space between two subfigures
\subfloat[subfloatA12]{\includegraphics[width = 0.475\textwidth,
height=0.35\textwidth]{figures/subfloatA12].eps}}
\subfloat[subfloatA21]{\includegraphics[width = 0.475\textwidth,
height=0.35\textwidth]{figures/subfloatA22].eps}}
\hspace*{\fill} % horizontal space between two subfigures
\subfloat[subfloatA22]{\includegraphics[width = 0.475\textwidth,
height=0.35\textwidth]{figures/subfloatA32.eps}}
\subfloat[subfloatA31]{\includegraphics[width = 0.475\textwidth,
height=0.35\textwidth]{figures/subfloatA31.eps}}
\hspace*{\fill} % horizontal space between two subfigures
\subfloat[subfloatA32]{\includegraphics[width = 0.475\textwidth,
height=0.35\textwidth]{figures/subfloatA32.eps}}
\caption{Performance}
\label{fig:perf}
\end{figure}
\end{document}
答案2
根据描述和代码,我猜您想让图像占据部分外边距。
这是一种可能性,我在中心留下了一个非常小的分离。
\documentclass[prodmode,acmtaco]{acmsmall} % Aptara syntax
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{lipsum} % just for the example
\begin{document}
\lipsum[1-3]
\begin{figure}[!tp]
\centering
\setkeys{Gin}{height=3cm} % just for the example
\makebox[\textwidth]{%
\setlength{\tabcolsep}{2pt}%
\begin{tabular}{@{}cc@{}}
\subfloat[subfloatA11]{\includegraphics[width = .6\textwidth]{example-image}} &
\subfloat[subfloatA11]{\includegraphics[width = .6\textwidth]{example-image}} \\
\subfloat[subfloatA11]{\includegraphics[width = .6\textwidth]{example-image}} &
\subfloat[subfloatA11]{\includegraphics[width = .6\textwidth]{example-image}} \\
\subfloat[subfloatA11]{\includegraphics[width = .6\textwidth]{example-image}} &
\subfloat[subfloatA11]{\includegraphics[width = .6\textwidth]{example-image}}
\end{tabular}%
}
\caption{Performance}
\label{fig:perf}
\end{figure}
\lipsum[4-10]
\end{document}
带有 的线条% just for the example
不适用于生产版本。
设置图像的高度和宽度会使图像变形,所以我不认为这真正是你想要的。
按照同样的想法,你可以尝试填满一个页面:
\documentclass[prodmode,acmtaco]{acmsmall} % Aptara syntax
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{lipsum} % just for the example
\begin{document}
\lipsum[1-3]
\begin{figure}[p]
\centering
\setkeys{Gin}{height=.28\textheight} % fill up the page
\makebox[\textwidth]{%
\setlength{\tabcolsep}{2pt}%
\begin{tabular}{@{}cc@{}}
\subfloat[subfloatA11]{\includegraphics{example-image}} &
\subfloat[subfloatA11]{\includegraphics{example-image}} \\
\subfloat[subfloatA11]{\includegraphics{example-image}} &
\subfloat[subfloatA11]{\includegraphics{example-image}} \\
\subfloat[subfloatA11]{\includegraphics{example-image}} &
\subfloat[subfloatA11]{\includegraphics{example-image}}
\end{tabular}%
}
\caption{Performance}
\label{fig:perf}
\end{figure}
\lipsum[4-10]
\end{document}
当然,如果图像对于给定的高度来说太宽,则此操作可能会失败。