7

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.

  • Have you tried simply \newcommand{\sizeA}{0.22}? – Rmano Apr 22 '15 at 8:20
  • @Rmano That was really simple, it works, thanks! – wondering Apr 22 '15 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 Apr 22 '15 at 9:17
8

Simple solution:

\newcommand{\mysize}{0.22}

and then

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.