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
|
% Images get their normal width if they fit onto the page, but
|
||||||
% are scaled down if they would overflow the margins.
|
% are scaled down if they would overflow the margins.
|
||||||
\makeatletter
|
\makeatletter
|
||||||
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
|
\def\ScaleIfNeeded{%
|
||||||
\else\Gin@nat@width\fi}
|
\ifdim\Gin@nat@width>\linewidth
|
||||||
|
\linewidth
|
||||||
|
\else
|
||||||
|
\Gin@nat@width
|
||||||
|
\fi
|
||||||
|
}
|
||||||
\makeatother
|
\makeatother
|
||||||
\let\Oldincludegraphics\includegraphics
|
\let\Oldincludegraphics\includegraphics
|
||||||
{%
|
{%
|
||||||
\catcode`\@=11\relax%
|
\catcode`\@=11\relax%
|
||||||
\gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\maxwidth]}}%
|
\gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\ScaleIfNeeded]}}%
|
||||||
}%
|
}%
|
||||||
$endif$
|
$endif$
|
||||||
\ifxetex
|
\ifxetex
|
||||||
|
|
Loading…
Add table
Reference in a new issue