default.latex: Use \ScaleIfNeeded w/ nicer def instead of \maxwidth.
This commit is contained in:
parent
2c876edb60
commit
7a93757ff1
1 changed files with 8 additions and 3 deletions
|
@ -70,13 +70,18 @@ $if(graphics)$
|
|||
% 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}
|
||||
\def\ScaleIfNeeded{%
|
||||
\ifdim\Gin@nat@width>\linewidth
|
||||
\linewidth
|
||||
\else
|
||||
\Gin@nat@width
|
||||
\fi
|
||||
}
|
||||
\makeatother
|
||||
\let\Oldincludegraphics\includegraphics
|
||||
{%
|
||||
\catcode`\@=11\relax%
|
||||
\gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\maxwidth]}}%
|
||||
\gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\ScaleIfNeeded]}}%
|
||||
}%
|
||||
$endif$
|
||||
\ifxetex
|
||||
|
|
Loading…
Reference in a new issue