我有以下代码生成的以下图像:
\begin{figure} [H]
\def\tabularxcolumn#1{m{#1}}
\begin{tabularx}{\linewidth}{@{}cXX@{}}
%
\begin{tabular}{cc}
\subfloat[Node 3 - Therapy Group 1 (443 patients)]{\includegraphics[width=5.5cm]{3e3}}
& \subfloat[ Node 4 - Therapy Group 0 \& Initial State Group 1 (116 patients) ]{\includegraphics[width=5.5cm]{3e4}}\\
\subfloat[Node 5 - Therapy Group 0 \& Initial State Group 2 (39 patients)]{\includegraphics[width=5.5cm]{1e5}}
& \subfloat[Node 6 - Therapy Group 0 \& Initial State Group 3 (16 patients)]{\includegraphics[width=5.5cm]{3e6}}\\
\subfloat[Node 7 -Therapy Group 0 \& Initial State Group 34 (8 patients)]{\includegraphics[width=5.5cm]{3e7}}
\end{tabular}
\end{tabularx}
我怎样才能 1) 缩小标题字体 2) 使整个图像居中于页面中间 3) 使最后一个图形 (e) 居中,另一个图形位于其上方 4) 使它们相距均匀,以便标题可以放在一行中
答案1
一个替代方案是使用floatrow
包裹。
\documentclass[a4paper]{article}
\usepackage{caption,floatrow,graphicx}
\usepackage[showframe]{geometry}
\DeclareCaptionSubType[alph]{figure}
\captionsetup[figure]{labelsep=colon}
\captionsetup[subfigure]{%
font=footnotesize,labelformat=brace,labelsep=space,labelfont=bf}
\floatsetup[subfigure]{capposition=bottom,heightadjust=all,valign=t}
\begin{document}
\begin{figure}[htp]
\ffigbox{%
\begin{subfloatrow}
\ffigbox
{\caption{Node 3 - Therapy Group 1 (443 patients)}}%
{\includegraphics[width=5.5cm]{example-image}}%
\ffigbox
{\caption{Node 4 - Therapy Group 0 \& Initial State Group 1
(116 patients)}}%
{\includegraphics[width=5.5cm]{example-image}}%
\end{subfloatrow}
\begin{subfloatrow}
\ffigbox
{\caption{Node 5 - Therapy Group 0 \& Initial State Group 2
(39 patients)}}%
{\includegraphics[width=5.5cm]{example-image}}%
\ffigbox
{\caption{Node 6 - Therapy Group 0 \& Initial State Group 3
(16 patients)}}%
{\includegraphics[width=5.5cm]{example-image}}%
\end{subfloatrow}\par
\begin{subfloatrow}
\ffigbox
{\caption{Node 7 -Therapy Group 0 \& Initial State Group 34 (8
patients)}}%
{\includegraphics[width=5.5cm]{example-image}}%
\end{subfloatrow}}
{\caption{Fitting for subsample 1}}
\end{figure}
\end{document}
答案2
请始终发布完整的文档,特别是显示所使用的包,我最初的猜测是subfloats
包,但我猜是subfig
。tabular
和特别是tabularx
在这里没有任何用处,可以简单地删除它们。
\documentclass{article}
\usepackage{subfig,graphicx}
\begin{document}
\begin{figure}
\centering
\subfloat[Node 3 - Therapy Group 1 (443 patients)]{\includegraphics[width=5.5cm]{example-image}}%
\hfill
\subfloat[ Node 4 - Therapy Group 0 \& Initial State Group 1 (116 patients) ]{\includegraphics[width=5.5cm]{example-image}}
\subfloat[Node 5 - Therapy Group 0 \& Initial State Group 2 (39 patients)]{\includegraphics[width=5.5cm]{example-image}}%
\hfill
\subfloat[Node 6 - Therapy Group 0 \& Initial State Group 3 (16 patients)]{\includegraphics[width=5.5cm]{example-image}}
\subfloat[Node 7 -Therapy Group 0 \& Initial State Group 34 (8 patients)]{\includegraphics[width=5.5cm]{example-image}}
\end{figure}
\noindent X\dotfill X
\end{document}
如果您需要更改字体,只需\small
在开头使用,figure
尽管字体必须小得多才能使标题适合一行。