Give LaTeX images a maximum width using the prelude only
This commit is contained in:
parent
15c3297ba9
commit
e365c5950b
3 changed files with 19 additions and 1 deletions
|
@ -338,7 +338,7 @@ inlineToLaTeX (Link txt (src, _)) =
|
|||
char '}'
|
||||
inlineToLaTeX (Image _ (source, _)) = do
|
||||
modify $ \s -> s{ stGraphics = True }
|
||||
return $ text $ "\\includegraphics{" ++ source ++ "}"
|
||||
return $ text $ "\\includegraphics{" ++ source ++ "}"
|
||||
inlineToLaTeX (Note contents) = do
|
||||
st <- get
|
||||
put (st {stInNote = True})
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -14,6 +14,15 @@
|
|||
\newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}
|
||||
\usepackage{url}
|
||||
\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}}
|
||||
\usepackage[breaklinks=true,unicode=true]{hyperref}
|
||||
\setlength{\parindent}{0pt}
|
||||
\setlength{\parskip}{6pt plus 2pt minus 1pt}
|
||||
|
|
Loading…
Reference in a new issue