|
99 | 99 | $if(tables)$ |
100 | 100 | \usepackage{longtable,booktabs} |
101 | 101 | $endif$ |
| 102 | + |
| 103 | +% -------------------------------- |
| 104 | +% Separating this because this no |
| 105 | +% longer works as of pandoc 3.2.1 |
| 106 | +% ------------------------------- |
| 107 | +%$if(graphics)$ |
| 108 | +%\usepackage{graphicx,grffile} |
| 109 | +%\makeatletter |
| 110 | +%\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} |
| 111 | +%\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} |
| 112 | +%\makeatother |
| 113 | +%% Scale images if necessary, so that they will not overflow the page |
| 114 | +%% margins by default, and it is still possible to overwrite the defaults |
| 115 | +%% using explicit options in \includegraphics[width, height, ...]{} |
| 116 | +%\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} |
| 117 | +%$endif$ |
| 118 | + |
| 119 | +% --------------------------------- |
| 120 | +% This works now: HT: Justin Esarey |
| 121 | +% --------------------------------- |
102 | 122 | $if(graphics)$ |
103 | | -\usepackage{graphicx,grffile} |
| 123 | +\usepackage{graphicx} |
104 | 124 | \makeatletter |
105 | | -\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} |
106 | | -\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} |
| 125 | +\newsavebox\pandoc@box |
| 126 | +\newcommand*\pandocbounded[1]{% scales image to fit in text height/width |
| 127 | + \sbox\pandoc@box{#1}% |
| 128 | + \Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}% |
| 129 | + \Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}% |
| 130 | + \ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both |
| 131 | + \ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}% |
| 132 | + \else\usebox{\pandoc@box}% |
| 133 | + \fi% |
| 134 | +} |
| 135 | +% Set default figure placement to htbp |
| 136 | +\def\fps@figure{htbp} |
107 | 137 | \makeatother |
108 | | -% Scale images if necessary, so that they will not overflow the page |
109 | | -% margins by default, and it is still possible to overwrite the defaults |
110 | | -% using explicit options in \includegraphics[width, height, ...]{} |
111 | | -\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} |
112 | 138 | $endif$ |
| 139 | + |
| 140 | +% ^ saving this note in case I want some kind of conditional operation thingie. |
| 141 | +% Note: I don't think you really need this, but I'll include it here just in case. |
| 142 | + |
113 | 143 | $if(links-as-notes)$ |
114 | 144 | % Make links footnotes instead of hotlinks: |
115 | 145 | \renewcommand{\href}[2]{#2\footnote{\url{#1}}} |
|
0 commit comments