aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2013-05-07 17:30:44 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2013-05-07 17:30:44 -0700
commit7a93757ff12f6ada1309c63dfc6e7ec5b7627762 (patch)
tree1082404b385f8a250accec3674a8c93ace593cdd
parent2c876edb6026e059f9cd0112ecd30e474866808e (diff)
downloadpandoc-7a93757ff12f6ada1309c63dfc6e7ec5b7627762.tar.gz
default.latex: Use \ScaleIfNeeded w/ nicer def instead of \maxwidth.
-rw-r--r--default.latex11
1 files changed, 8 insertions, 3 deletions
diff --git a/default.latex b/default.latex
index c91a03861..5ef9170a9 100644
--- a/default.latex
+++ b/default.latex
@@ -70,13 +70,18 @@ $if(graphics)$
% Images get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins.
\makeatletter
-\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
-\else\Gin@nat@width\fi}
+\def\ScaleIfNeeded{%
+ \ifdim\Gin@nat@width>\linewidth
+ \linewidth
+ \else
+ \Gin@nat@width
+ \fi
+}
\makeatother
\let\Oldincludegraphics\includegraphics
{%
\catcode`\@=11\relax%
- \gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\maxwidth]}}%
+ \gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\ScaleIfNeeded]}}%
}%
$endif$
\ifxetex