summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorMax Bolingbroke <batterseapower@hotmail.com>2010-04-04 16:36:37 +0800
committerjgm <jgm@berkeley.edu>2010-04-10 12:01:35 +0800
commite365c5950b1b6ee85123d4b376025a6bb0697f7d (patch)
tree4d0b653df30e29fdbc91974f8ee6af16117dc1c3 /templates
parent15c3297ba97aa5ea7fdb74479d345242ed418772 (diff)
Give LaTeX images a maximum width using the prelude only
Diffstat (limited to 'templates')
-rw-r--r--templates/latex.template9
1 files changed, 9 insertions, 0 deletions
diff --git a/templates/latex.template b/templates/latex.template
index 02e570a76..67ac2dbf5 100644
--- a/templates/latex.template
+++ b/templates/latex.template
@@ -50,6 +50,15 @@ $if(url)$
$endif$
$if(graphics)$
\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
+% are scaled down if they would overflow the margins.
+\makeatletter
+\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
+\else\Gin@nat@width\fi}
+\makeatother
+\let\Oldincludegraphics\includegraphics
+\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
$endif$
\usepackage[breaklinks=true,unicode=true]{hyperref}
\setlength{\parindent}{0pt}