Skip to content

Commit

Permalink
Add LaTeX macros that seem to be used by the latest Pandoc (#1356)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavpanchekha authored Nov 3, 2024
1 parent 72dfee1 commit eb642c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions infra/template-book.tex
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,16 @@
\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}
\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%
}
\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
Expand Down
1 change: 1 addition & 0 deletions latex/macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
\defbox{further}{Go Further}{ForestGreen}
\defbox{example}{Example}{Gray}
\defbox{notcode}{}{Black}
\defbox{author-picture}{}{Black}

% Finally we define the actual "bookblock" environment that our
% Markdown will expand divs into
Expand Down

0 comments on commit eb642c7

Please sign in to comment.