aboutsummaryrefslogtreecommitdiff
path: root/templates/latex.template
diff options
context:
space:
mode:
Diffstat (limited to 'templates/latex.template')
-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}