mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Keep original `\includegraphics
, use only
\sphinxincludegraphics
`.
modified: CHANGES modified: sphinx/texinputs/sphinx.sty
This commit is contained in:
parent
9afebd7b3b
commit
3549b7c621
2
CHANGES
2
CHANGES
@ -6,6 +6,8 @@ Incompatible changes
|
|||||||
|
|
||||||
* #1061, #2336, #3235: Now generation of autosummary doesn't contain imported
|
* #1061, #2336, #3235: Now generation of autosummary doesn't contain imported
|
||||||
members by default. Thanks to Luc Saffre.
|
members by default. Thanks to Luc Saffre.
|
||||||
|
* LaTeX ``\includegraphics`` command isn't overloaded: only ``\sphinxincludegraphics``
|
||||||
|
has the custom code to fit image to available width if oversized.
|
||||||
|
|
||||||
Features added
|
Features added
|
||||||
--------------
|
--------------
|
||||||
|
@ -894,33 +894,25 @@
|
|||||||
\raggedright}
|
\raggedright}
|
||||||
{\end{list}}
|
{\end{list}}
|
||||||
|
|
||||||
% Redefine \includegraphics to resize images larger than the line width,
|
% \sphinxincludegraphics defined to resize images larger than the line width,
|
||||||
% except if height or width option present.
|
% except if height or width option present.
|
||||||
%
|
%
|
||||||
% If scale is present, rescale before fitting to line width. (since 1.5)
|
% If scale is present, rescale before fitting to line width. (since 1.5)
|
||||||
%
|
|
||||||
% Warning: future version of Sphinx will not modify original \includegraphics,
|
|
||||||
% below code will be definition only of \sphinxincludegraphics.
|
|
||||||
\let\py@Oldincludegraphics\includegraphics
|
|
||||||
\newbox\spx@image@box
|
\newbox\spx@image@box
|
||||||
\renewcommand*{\includegraphics}[2][]{%
|
\newcommand*{\sphinxincludegraphics}[2][]{%
|
||||||
\in@{height}{#1}\ifin@\else\in@{width}{#1}\fi
|
\in@{height}{#1}\ifin@\else\in@{width}{#1}\fi
|
||||||
\ifin@ % height or width present
|
\ifin@ % height or width present
|
||||||
\py@Oldincludegraphics[#1]{#2}%
|
\includegraphics[#1]{#2}%
|
||||||
\else % no height nor width (but #1 may be "scale=...")
|
\else % no height nor width (but #1 may be "scale=...")
|
||||||
\setbox\spx@image@box\hbox{\py@Oldincludegraphics[#1,draft]{#2}}%
|
\setbox\spx@image@box\hbox{\includegraphics[#1,draft]{#2}}%
|
||||||
\ifdim \wd\spx@image@box>\linewidth
|
\ifdim \wd\spx@image@box>\linewidth
|
||||||
\setbox\spx@image@box\box\voidb@x % clear memory
|
\setbox\spx@image@box\box\voidb@x % clear memory
|
||||||
\py@Oldincludegraphics[#1,width=\linewidth]{#2}%
|
\includegraphics[#1,width=\linewidth]{#2}%
|
||||||
\else
|
\else
|
||||||
\py@Oldincludegraphics[#1]{#2}%
|
\includegraphics[#1]{#2}%
|
||||||
\fi
|
\fi
|
||||||
\fi
|
\fi
|
||||||
}
|
}
|
||||||
% Writer will put \sphinxincludegraphics in LaTeX source, and with this,
|
|
||||||
% documents which used their own modified \includegraphics will compile
|
|
||||||
% as before. But see warning above.
|
|
||||||
\newcommand*{\sphinxincludegraphics}{\includegraphics}
|
|
||||||
|
|
||||||
% to make pdf with correct encoded bookmarks in Japanese
|
% to make pdf with correct encoded bookmarks in Japanese
|
||||||
% this should precede the hyperref package
|
% this should precede the hyperref package
|
||||||
|
Loading…
Reference in New Issue
Block a user