Skip to content

Commit 9dbdcdb

Browse files
committed
Switch to pandoc/latex:3.2.1
That version is still supported.
1 parent 6b43cac commit 9dbdcdb

File tree

4 files changed

+70
-23
lines changed

4 files changed

+70
-23
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Released 2024-05-11
2-
FROM pandoc/latex:3.2.0-alpine
2+
FROM pandoc/latex:3.2.1-alpine
33

44
RUN apk add --no-cache ttf-hack
55

data/templates/default.latex

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,23 @@ $endif$
322322
$if(tables)$
323323
\usepackage{longtable,booktabs,array}
324324
$endif$
325+
$if(graphics)$
326+
\usepackage{graphicx}
327+
\makeatletter
328+
\newsavebox\pandoc@box
329+
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
330+
\sbox\pandoc@box{#1}%
331+
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
332+
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
333+
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
334+
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
335+
\else\usebox{\pandoc@box}%
336+
\fi%
337+
}
338+
% Set default figure placement to htbp
339+
\def\fps@figure{htbp}
340+
\makeatother
341+
$endif$
325342
$-- add watermark and linenumbers unless this is the final (non-draft) version
326343
$if(draft)$
327344
\usepackage{lineno}

test/expected-draft/paper.tex

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,21 @@
313313
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}}
314314
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}}
315315
\usepackage{longtable,booktabs,array}
316+
\usepackage{graphicx}
317+
\makeatletter
318+
\newsavebox\pandoc@box
319+
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
320+
\sbox\pandoc@box{#1}%
321+
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
322+
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
323+
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
324+
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
325+
\else\usebox{\pandoc@box}%
326+
\fi%
327+
}
328+
% Set default figure placement to htbp
329+
\def\fps@figure{htbp}
330+
\makeatother
316331
\usepackage{lineno}
317332
\linenumbers
318333
\usepackage{draftwatermark}
@@ -484,9 +499,9 @@ \subsection{Inline markup}\label{inline-markup}
484499
below gives a small example.
485500

486501
\begin{longtable}[]{@{}
487-
>{\raggedright\arraybackslash}p{(\columnwidth - 4\tabcolsep) * \real{0.3014}}
488-
>{\centering\arraybackslash}p{(\columnwidth - 4\tabcolsep) * \real{0.3562}}
489-
>{\centering\arraybackslash}p{(\columnwidth - 4\tabcolsep) * \real{0.3288}}@{}}
502+
>{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3014}}
503+
>{\centering\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3562}}
504+
>{\centering\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3288}}@{}}
490505
\caption{Basic inline markup and examples.}\tabularnewline
491506
\toprule\noalign{}
492507
\begin{minipage}[b]{\linewidth}\raggedright
@@ -567,12 +582,12 @@ \subsubsection{Images}\label{images}
567582
e.g.~when adding an image as part of a paragraph. The Markdown
568583
\texttt{!{[}Nyan\ cat{]}(nyan-cat.png)\{height="9pt"\}} includes the
569584
image ``nyan-cat.png''
570-
\includegraphics[width=\textwidth,height=0.125in]{images/nyan-cat.png}
585+
\includegraphics[width=\linewidth,height=0.125in,keepaspectratio]{images/nyan-cat.png}
571586
while scaling it to a height of 9\,pt.
572587

573588
\begin{figure}
574589
\centering
575-
\includegraphics{images/mandrill.jpg}
590+
\pandocbounded{\includegraphics[keepaspectratio]{images/mandrill.jpg}}
576591
\caption{The ``Mandrill'' standard test image, sometimes erroneously
577592
called ``Baboon'', is a popular sample photo and used in image
578593
processing research.}\label{fig:mandrill}
@@ -885,7 +900,7 @@ \section{Internal references}\label{internal-references}
885900

886901
\begin{figure}
887902
\centering
888-
\includegraphics[width=1\textwidth,height=\textheight]{images/sylt.jpg}
903+
\includegraphics[width=1\linewidth,height=\textheight,keepaspectratio]{images/sylt.jpg}
889904
\caption{View of coastal dunes in a nature reserve on Sylt, an island in
890905
the North Sea. Sylt (Danish: \emph{Slid}) is Germany's northernmost
891906
island.}\label{sylt}
@@ -909,11 +924,11 @@ \subsection{Tables and figures}\label{tables-and-figures}
909924
gives ``\ref{proglangs}''.
910925

911926
\begin{longtable}[]{@{}
912-
>{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.1493}}
913-
>{\centering\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.2537}}
914-
>{\centering\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.2836}}
915-
>{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.1791}}
916-
>{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.1343}}@{}}
927+
>{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1493}}
928+
>{\centering\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2537}}
929+
>{\centering\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2836}}
930+
>{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1791}}
931+
>{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1343}}@{}}
917932
\caption{Comparison of programming languages used in the publishing
918933
tool. {}}\tabularnewline
919934
\toprule\noalign{}

test/expected-pub/paper.tex

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,21 @@
313313
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}}
314314
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}}
315315
\usepackage{longtable,booktabs,array}
316+
\usepackage{graphicx}
317+
\makeatletter
318+
\newsavebox\pandoc@box
319+
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
320+
\sbox\pandoc@box{#1}%
321+
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
322+
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
323+
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
324+
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
325+
\else\usebox{\pandoc@box}%
326+
\fi%
327+
}
328+
% Set default figure placement to htbp
329+
\def\fps@figure{htbp}
330+
\makeatother
316331

317332
\usepackage{graphicx,grffile}
318333
\makeatletter
@@ -482,9 +497,9 @@ \subsection{Inline markup}\label{inline-markup}
482497
below gives a small example.
483498

484499
\begin{longtable}[]{@{}
485-
>{\raggedright\arraybackslash}p{(\columnwidth - 4\tabcolsep) * \real{0.3014}}
486-
>{\centering\arraybackslash}p{(\columnwidth - 4\tabcolsep) * \real{0.3562}}
487-
>{\centering\arraybackslash}p{(\columnwidth - 4\tabcolsep) * \real{0.3288}}@{}}
500+
>{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3014}}
501+
>{\centering\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3562}}
502+
>{\centering\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3288}}@{}}
488503
\caption{Basic inline markup and examples.}\tabularnewline
489504
\toprule\noalign{}
490505
\begin{minipage}[b]{\linewidth}\raggedright
@@ -565,12 +580,12 @@ \subsubsection{Images}\label{images}
565580
e.g.~when adding an image as part of a paragraph. The Markdown
566581
\texttt{!{[}Nyan\ cat{]}(nyan-cat.png)\{height="9pt"\}} includes the
567582
image ``nyan-cat.png''
568-
\includegraphics[width=\textwidth,height=0.125in]{images/nyan-cat.png}
583+
\includegraphics[width=\linewidth,height=0.125in,keepaspectratio]{images/nyan-cat.png}
569584
while scaling it to a height of 9\,pt.
570585

571586
\begin{figure}
572587
\centering
573-
\includegraphics{images/mandrill.jpg}
588+
\pandocbounded{\includegraphics[keepaspectratio]{images/mandrill.jpg}}
574589
\caption{The ``Mandrill'' standard test image, sometimes erroneously
575590
called ``Baboon'', is a popular sample photo and used in image
576591
processing research.}\label{fig:mandrill}
@@ -883,7 +898,7 @@ \section{Internal references}\label{internal-references}
883898

884899
\begin{figure}
885900
\centering
886-
\includegraphics[width=1\textwidth,height=\textheight]{images/sylt.jpg}
901+
\includegraphics[width=1\linewidth,height=\textheight,keepaspectratio]{images/sylt.jpg}
887902
\caption{View of coastal dunes in a nature reserve on Sylt, an island in
888903
the North Sea. Sylt (Danish: \emph{Slid}) is Germany's northernmost
889904
island.}\label{sylt}
@@ -907,11 +922,11 @@ \subsection{Tables and figures}\label{tables-and-figures}
907922
gives ``\ref{proglangs}''.
908923

909924
\begin{longtable}[]{@{}
910-
>{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.1493}}
911-
>{\centering\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.2537}}
912-
>{\centering\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.2836}}
913-
>{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.1791}}
914-
>{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.1343}}@{}}
925+
>{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1493}}
926+
>{\centering\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2537}}
927+
>{\centering\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2836}}
928+
>{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1791}}
929+
>{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1343}}@{}}
915930
\caption{Comparison of programming languages used in the publishing
916931
tool. {}}\tabularnewline
917932
\toprule\noalign{}

0 commit comments

Comments
 (0)