meaning of ! in \includegraphics in graphicx

David Carlisle d.p.carlisle at
Wed Jan 22 09:00:04 CET 2020

On Wed, 22 Jan 2020 at 03:56, Paulo Ney de Souza <pauloney at> wrote:
> What is the (precise) meaning of ! in a command like
>    \includegraphics[width=.8\textwidth,height=!]{figure.eps}

this is trapped and converted to

which, as you say scales the width to the specified width, and the
height by the same scale factor.

Or at least that's what is supposed to happen, there are a lot of
different code paths here depending on what driver option you are

\def\Gin at eresize{\height}
\def\Gin at esetsize{%
  \let\@tempa\Gin at exclamation
  \if at tempswa
%    \end{macrocode}
%  External. Wrap the |\includegraphics| command in a call to the
%  internal form of |\scalebox| to handle the rotation.
%    \begin{macrocode}
             \Gscale@@box\noexpand\Gin at eresize
              {\Gin at ewidth}{\Gin at eheight}{\the\toks@}}}%
%    \end{macrocode}
% Internal. Handle scaling with the |\includegraphics| command directly
% rather than calling |\scalebox|.


> I started by guessing that the graphics would be reslzed by the proportion defined on the other axis .. but after some further experimentation I an not really convinced ...
> The documentation is completely silent on it. The only mention of ! in in the context f \resizebox some text.
> Paulo Ney

More information about the texhax mailing list