Created
February 15, 2020 15:59
-
-
Save Abdelkrim/b3633f337e210fa40b12e871ad90da74 to your computer and use it in GitHub Desktop.
sphinx, latex, resize figures that are too wide for the page and ensure they take the full width of the page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Made by ALT-F1 SPRL, Abdelkrim Boujraf | |
%\usepackage{bookmark} | |
%\usepackage{charter} | |
%\usepackage[defaultsans]{lato} | |
%\usepackage{inconsolata} | |
% \usepackage{pbsi} | |
% \usepackage[T1]{fontenc} | |
% \usepackage[T1]{fontenc} | |
% \usepackage{accanthis} | |
\usepackage{graphicx} | |
% Determine if the image is too wide for the page. | |
\makeatletter | |
\def\ScaleIfNeeded{% | |
\ifdim\Gin@nat@width>\linewidth | |
\linewidth | |
\else | |
\Gin@nat@width | |
\fi | |
} | |
\makeatother | |
% Resize figures that are too wide for the page. | |
\let\oldincludegraphics\includegraphics | |
\renewcommand\includegraphics[2][]{% | |
\oldincludegraphics[width=\ScaleIfNeeded]{#2} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment