Fix issue #52: set max width and height of images in default.beamer

This commit is contained in:
Garrick Aden-Buie
2014-04-11 10:52:09 -07:00
committed by John MacFarlane
parent 79806d4417
commit b8ae07eb09
+8 -17
View File
@@ -66,25 +66,16 @@ $if(url)$
\usepackage{url}
$endif$
$if(graphics)$
\usepackage{graphicx}
% Redefine \includegraphics so that, unless explicit options are
% given, the image width will not exceed the width of the page.
% Images get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins.
\usepackage{letltxmacro}
\makeatletter
\def\ScaleIfNeeded{%
\ifdim\Gin@nat@width>\linewidth
\linewidth
\else
\Gin@nat@width
\fi
}
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight0.8\textheight\else\Gin@nat@height\fi}
\makeatother
\let\Oldincludegraphics\includegraphics
{%
\catcode`\@=11\relax%
\gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\ScaleIfNeeded]}}%
}%
\AtBeginDocument{
\LetLtxMacro\Oldincludegraphics\includegraphics
\renewcommand{\includegraphics}[2][]{%
\Oldincludegraphics[#1,width=\maxwidth,height=\maxheight,keepaspectratio]{#2}}
}
$endif$
% Comment these out if you don't want a slide with just the