git.iko.soy/typeable/pandoc
on master help sign in
Updated tests for template changes.
commit816a5540f4752a619d2bf939329d52bc184fc942 authorJohn MacFarlane <fiddlosopher@gmail.com> dateTue 7 May 2013, 19:50 (13 years ago) parent2e3eb9e
1 file changed+14−5
tests/writer.latex+14−5
tests/writer.latex+14−5
@@ -22,15 +22,24 @@
2222\IfFileExists{microtype.sty}{\usepackage{microtype}}{}
2323\usepackage{fancyvrb}
2424\usepackage{graphicx}
25−% We will generate all images so they have a width \maxwidth. This means
26−% that they will get their normal width if they fit onto the page, but
25+% Redefine \includegraphics so that, unless explicit options are
26+% given, the image width will not exceed the width of the page.
27+% Images get their normal width if they fit onto the page, but
2728% are scaled down if they would overflow the margins.
2829\makeatletter
29−\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
30−\else\Gin@nat@width\fi}
30+\def\ScaleIfNeeded{%
31+ \ifdim\Gin@nat@width>\linewidth
32+ \linewidth
33+ \else
34+ \Gin@nat@width
35+ \fi
36+}
3137\makeatother
3238\let\Oldincludegraphics\includegraphics
33−\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
39+{%
40+ \catcode`\@=11\relax%
41+ \gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\ScaleIfNeeded]}}%
42+}%
3443\ifxetex
3544 \usepackage[setpagesize=false, % page size defined by xetex
3645 unicode=false, % unicode breaks when used with xetex