[Tex/LaTex] How to set the minimum width of a subfigure

subfloatstikz-pgfwidth

I have:

\subfigure[blah blah blah.]
{
\begin{tikzpicture}[/MyStyle]
    ... some stuff...
\end{tikzpicture} 
}

But "some stuff" is not that wide and the text in the subfigure produces a lot of underfull hboxes. I want to make the subfigure wider. How do I do that?

Best Answer

A general approach for customizing the width and the height of a subfigure is using the adjustbox package. It provides features for trimming (also with negative value, so enlarging), clipping, scaling, rotating etc. which can be applied also to TikZ pictures.

An example where the subfigure has been made wider by 1 cm on the left and on the right:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{adjustbox}
\usepackage{subfig}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{figure}
\subfloat{Test figure}
\subfloat[The ball]{%
  \trimbox{-1cm 0cm -1cm 0cm}{%
    \begin{tikzpicture}
      \node[circle,shading=ball,ball color=red!80!white,minimum size=2cm] {};
    \end{tikzpicture}}}
\subfloat{Test figure}
\end{figure}
\end{document}

Without \trimbox:

subfigures

With \trimbox:

widened subfigure