aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-05-07 19:50:23 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-05-07 19:50:23 -0700
commit816a5540f4752a619d2bf939329d52bc184fc942 (patch)
treed8bc3c99ccad7e0b1c9d3c16f54c646a45d7797c /tests
parent2e3eb9ef6ad754c4a388d15097f8a56f80e810fe (diff)
downloadpandoc-816a5540f4752a619d2bf939329d52bc184fc942.tar.gz
Updated tests for template changes.
Diffstat (limited to 'tests')
-rw-r--r--tests/writer.latex19
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/writer.latex b/tests/writer.latex
index d3f544fb3..04924f0b1 100644
--- a/tests/writer.latex
+++ b/tests/writer.latex
@@ -22,15 +22,24 @@
\IfFileExists{microtype.sty}{\usepackage{microtype}}{}
\usepackage{fancyvrb}
\usepackage{graphicx}
-% We will generate all images so they have a width \maxwidth. This means
-% that they will get their normal width if they fit onto the page, but
+% 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.
\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
-\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
+{%
+ \catcode`\@=11\relax%
+ \gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\ScaleIfNeeded]}}%
+}%
\ifxetex
\usepackage[setpagesize=false, % page size defined by xetex
unicode=false, % unicode breaks when used with xetex