@@ -70,13 +70,18 @@ $if(graphics)$
7070% Images get their normal width if they fit onto the page, but
7171% are scaled down if they would overflow the margins.
7272\makeatletter
73−\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
74−\else\Gin@nat@width\fi}
73+\def\ScaleIfNeeded{%
74+ \ifdim\Gin@nat@width>\linewidth
75+ \linewidth
76+ \else
77+ \Gin@nat@width
78+ \fi
79+}
7580\makeatother
7681\let\Oldincludegraphics\includegraphics
7782{%
7883 \catcode`\@=11\relax%
79− \gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\maxwidth]}}%
84+ \gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\ScaleIfNeeded]}}%
8085}%
8186$endif$
8287\ifxetex