@@ -22,24 +22,14 @@
2222\IfFileExists{microtype.sty}{\usepackage{microtype}}{}
2323\usepackage{fancyvrb}
2424\usepackage{graphicx}
25−% Redefine \includegraphics so that, unless explicit options are
26−% given, the image width will not exceed the width of the page.
27−% Images get their normal width if they fit onto the page, but
28−% are scaled down if they would overflow the margins.
2925\makeatletter
30−\def\ScaleIfNeeded{%
31− \ifdim\Gin@nat@width>\linewidth
32− \linewidth
33− \else
34− \Gin@nat@width
35− \fi
36−}
26+\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
27+\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
3728\makeatother
38−\let\Oldincludegraphics\includegraphics
39−{%
40− \catcode`\@=11\relax%
41− \gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\ScaleIfNeeded]}}%
42−}%
29+% Scale images if necessary, so that they will not overflow the page
30+% margins by default, and it is still possible to overwrite the defaults
31+% using explicit options in \includegraphics[width, height, ...]{}
32+\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
4333\ifxetex
4434 \usepackage[setpagesize=false, % page size defined by xetex
4535 unicode=false, % unicode breaks when used with xetex