default.latex: Redefine includegraphics to allow custom options.
Thanks to Bernhard Weichel. Now, literal \includegraphics commands with square-bracketed options will work properly. When no options are given, a default option limits images to the text width.
This commit is contained in:
parent
fd59e11e15
commit
2c876edb60
1 changed files with 7 additions and 3 deletions
|
@ -65,15 +65,19 @@ $if(tables)$
|
|||
$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
|
||||
% 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\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
|
||||
\else\Gin@nat@width\fi}
|
||||
\makeatother
|
||||
\let\Oldincludegraphics\includegraphics
|
||||
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
|
||||
{%
|
||||
\catcode`\@=11\relax%
|
||||
\gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\maxwidth]}}%
|
||||
}%
|
||||
$endif$
|
||||
\ifxetex
|
||||
\usepackage[setpagesize=false, % page size defined by xetex
|
||||
|
|
Loading…
Add table
Reference in a new issue