From eb642c7194684cd8c1205fdf461d8811d34d693b Mon Sep 17 00:00:00 2001 From: Pavel Panchekha Date: Sat, 2 Nov 2024 18:57:43 -0600 Subject: [PATCH] Add LaTeX macros that seem to be used by the latest Pandoc (#1356) --- infra/template-book.tex | 10 ++++++++++ latex/macros.tex | 1 + 2 files changed, 11 insertions(+) diff --git a/infra/template-book.tex b/infra/template-book.tex index 09fe13db8..9bd67adc4 100644 --- a/infra/template-book.tex +++ b/infra/template-book.tex @@ -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 diff --git a/latex/macros.tex b/latex/macros.tex index 05651c8e9..d31d3a2f0 100644 --- a/latex/macros.tex +++ b/latex/macros.tex @@ -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