11

I have several pictures in my document, using the subfigure environment, the code is the following:

\begin{subfigure}[b]{0.22\textwidth}
\includegraphics[width=\textwidth]{pictures/...}
\end{subfigure}

Now, the size of the pictures will be the same for all of them. When I adjust their size, I don't want to change 0.22 to some other value for all of them. Can I define some variable? I tried with \newlength, but this register requires a unit of length.

3
  • Have you tried simply \newcommand{\sizeA}{0.22}?
    – Rmano
    Commented Apr 22, 2015 at 8:20
  • @Rmano That was really simple, it works, thanks!
    – wondering
    Commented Apr 22, 2015 at 8:36
  • 1
    If you use graphicx then I suggest you read the package documentation because it explains how to define defaults with \setkeys. Also see this presentation.
    – user10274
    Commented Apr 22, 2015 at 9:17

1 Answer 1

13

Simple solution:

\newcommand{\mysize}{0.22}

and then

\begin{subfigure}[b]{\mysize\textwidth}
\includegraphics[width=\textwidth]{pictures/...}
\end{subfigure}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .