From 1ad0d6d7873bc76a2fb16f22bc28678f1e25b881 Mon Sep 17 00:00:00 2001 From: Jamie Steiner Date: Wed, 18 Sep 2024 22:24:31 +0300 Subject: [PATCH] adding \pandocbounded macro for pandoc 3.2.1 (#392) --- eisvogel.tex | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/eisvogel.tex b/eisvogel.tex index 109cb83..9555547 100644 --- a/eisvogel.tex +++ b/eisvogel.tex @@ -365,15 +365,17 @@ $if(graphics)$ \usepackage{graphicx} \makeatletter -\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} -\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} -\makeatother -% Scale images if necessary, so that they will not overflow the page -% margins by default, and it is still possible to overwrite the defaults -% using explicit options in \includegraphics[width, height, ...]{} -\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} +\newsavebox\pandoc@box +\newcommand*\pandocbounded[1]{% scales image to fit in text height/width + \sbox\pandoc@box{#1}% + \Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}% + \Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}% + \ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both + \ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}% + \else\usebox{\pandoc@box}% + \fi% +} % Set default figure placement to htbp -\makeatletter % Make use of float-package and set default placement for figures to H. % The option H means 'PUT IT HERE' (as opposed to the standard h option which means 'You may put it here if you like'). \usepackage{float}