summaryrefslogtreecommitdiff
path: root/tests/writer.latex
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-04-30 23:29:10 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-04-30 23:29:10 -0700
commitac104c4fdb957937c163a558348934a95fc13727 (patch)
tree46d244bf40b4941027617d9e940091117e89a5ca /tests/writer.latex
parent9ea9b916af66995c878ab89e6122e5d2b58dde84 (diff)
Updated tests for new LaTeX template.
Diffstat (limited to 'tests/writer.latex')
-rw-r--r--tests/writer.latex22
1 files changed, 6 insertions, 16 deletions
diff --git a/tests/writer.latex b/tests/writer.latex
index 4cb989fba..a2f973854 100644
--- a/tests/writer.latex
+++ b/tests/writer.latex
@@ -22,24 +22,14 @@
\IfFileExists{microtype.sty}{\usepackage{microtype}}{}
\usepackage{fancyvrb}
\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.
\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>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
-\let\Oldincludegraphics\includegraphics
-{%
- \catcode`\@=11\relax%
- \gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\ScaleIfNeeded]}}%
-}%
+% Scale images if necessary, so that they will not overflow the page
+% margins by default, and it is still possible to overwrite the defaults
+% using explicit options in \includegraphics[width, height, ...]{}
+\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\ifxetex
\usepackage[setpagesize=false, % page size defined by xetex
unicode=false, % unicode breaks when used with xetex