aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrick Aden-Buie <gadenbuie@mail.usf.edu>2014-04-09 23:59:16 -0400
committerJohn MacFarlane <jgm@berkeley.edu>2014-04-11 10:52:09 -0700
commitb8ae07eb09b921beec11d67ea35b4f79941fdd09 (patch)
tree63460ffb9f4a49a54015e4374eef295ac86cb517
parent79806d4417d02646158dcbdcc3686255098c9e3f (diff)
downloadpandoc-b8ae07eb09b921beec11d67ea35b4f79941fdd09.tar.gz
Fix issue #52: set max width and height of images in default.beamer
-rw-r--r--default.beamer25
1 files changed, 8 insertions, 17 deletions
diff --git a/default.beamer b/default.beamer
index b220a43b9..0806e362f 100644
--- a/default.beamer
+++ b/default.beamer
@@ -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