default.latex: Use \ScaleIfNeeded w/ nicer def instead of \maxwidth.

This commit is contained in:
John MacFarlane 2013-05-07 17:30:44 -07:00
parent 2c876edb60
commit 7a93757ff1

View file

@ -70,13 +70,18 @@ $if(graphics)$
% Images get their normal width if they fit onto the page, but % Images get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins. % are scaled down if they would overflow the margins.
\makeatletter \makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth \def\ScaleIfNeeded{%
\else\Gin@nat@width\fi} \ifdim\Gin@nat@width>\linewidth
\linewidth
\else
\Gin@nat@width
\fi
}
\makeatother \makeatother
\let\Oldincludegraphics\includegraphics \let\Oldincludegraphics\includegraphics
{% {%
\catcode`\@=11\relax% \catcode`\@=11\relax%
\gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\maxwidth]}}% \gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\ScaleIfNeeded]}}%
}% }%
$endif$ $endif$
\ifxetex \ifxetex