0

I have the following images produced by the following code:

\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}

How can I 1) Make the caption font smaller 2) get the whole image centered to the middle of the page 3) get the last figure (e) centered with the other above it 4) get them even apart so that the caption would fit in 1 line

2 Answers2

2

An alternative would be the floatrow package.

\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}

enter image description here

Arash Esbati
  • 7,416
1

Please always post full documents, in particular showing packages used, my initial guess was subfloats package but I guess it was subfig. the tabular and especially the tabularx are doing nothing useful here, they can simply be deleted.

\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}

If you need to change the font simply use \small at the start of the figure although the font would have to be much smaller to make the captions fit on one line.

enter image description here

David Carlisle
  • 757,742
  • the font is still bound to under the picture only though. I wish it can go outside more – user1930901 May 26 '15 at 20:06
  • @user1930901 well the whole point of the package seems to be to set the caption to the width of the content, however you can make that content wider by eg \subfloat[Node 3 - Therapy Group 1 (443 patients)]{\hspace{.1in}\includegraphics[width=5.5cm]{example-image}\hspace{.1in}}% although you can not add much more than that .2in as, as shown in the image above there is not that much space (assuming you are using usletter,again, you did not say) to get two 5.5in images side by side – David Carlisle May 26 '15 at 20:13
  • thanks! also is there a way to start labelling from (c) for instance instead of (a) ? – user1930901 May 26 '15 at 21:02