|
248 | 248 | \makesavenoteenv{longtable} |
249 | 249 | $endif$ |
250 | 250 | $endif$ |
| 251 | + |
| 252 | +% -------------------------------- |
| 253 | +% Separating this because this no |
| 254 | +% longer works as of pandoc 3.2.1 |
| 255 | +% ------------------------------- |
| 256 | +%$if(graphics)$ |
| 257 | +%\usepackage{graphicx} |
| 258 | +%\makeatletter |
| 259 | +%\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} |
| 260 | +%\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} |
| 261 | +%\makeatother |
| 262 | +%% Scale images if necessary, so that they will not overflow the page |
| 263 | +%% margins by default, and it is still possible to overwrite the defaults |
| 264 | +%% using explicit options in \includegraphics[width, height, ...]{} |
| 265 | +%\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} |
| 266 | +%% Set default figure placement to htbp |
| 267 | +%\makeatletter |
| 268 | +%\def\fps@figure{htbp} |
| 269 | +%\makeatother |
| 270 | +%$endif$ |
| 271 | + |
| 272 | +% --------------------------------- |
| 273 | +% This works now: HT: Justin Esarey |
| 274 | +% --------------------------------- |
251 | 275 | $if(graphics)$ |
252 | 276 | \usepackage{graphicx} |
253 | 277 | \makeatletter |
254 | | -\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} |
255 | | -\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} |
256 | | -\makeatother |
257 | | -% Scale images if necessary, so that they will not overflow the page |
258 | | -% margins by default, and it is still possible to overwrite the defaults |
259 | | -% using explicit options in \includegraphics[width, height, ...]{} |
260 | | -\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} |
| 278 | +\newsavebox\pandoc@box |
| 279 | +\newcommand*\pandocbounded[1]{% scales image to fit in text height/width |
| 280 | + \sbox\pandoc@box{#1}% |
| 281 | + \Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}% |
| 282 | + \Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}% |
| 283 | + \ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both |
| 284 | + \ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}% |
| 285 | + \else\usebox{\pandoc@box}% |
| 286 | + \fi% |
| 287 | +} |
261 | 288 | % Set default figure placement to htbp |
262 | | -\makeatletter |
263 | 289 | \def\fps@figure{htbp} |
264 | 290 | \makeatother |
265 | 291 | $endif$ |
| 292 | + |
| 293 | +% ^ saving this note in case I want some kind of conditional operation thingie. |
| 294 | + |
| 295 | + |
266 | 296 | $if(links-as-notes)$ |
267 | 297 | % Make links footnotes instead of hotlinks: |
268 | 298 | \DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}} |
|
0 commit comments