Skip to content

Commit 763ba7b

Browse files
committed
Updated RJournal.sty to define pandocbounded
1 parent 9779f02 commit 763ba7b

File tree

5 files changed

+65
-5
lines changed

5 files changed

+65
-5
lines changed

inst/paper-with-errors/RJournal.sty

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
% should be specified in RJwrapper.tex
1313

1414
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
15-
\ProvidesPackage{RJournal}[2025/05/07 v0.15 RJournal package]
15+
\ProvidesPackage{RJournal}[2025/07/15 v0.16 RJournal package]
1616

1717
\RequirePackage{tikz}
1818

@@ -313,6 +313,18 @@
313313

314314
% Figures ----------------------------------------------------------------------
315315

316+
% For use with pandoc > 3.2.1
317+
\newsavebox\pandoc@box
318+
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
319+
\sbox\pandoc@box{#1}%
320+
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
321+
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
322+
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
323+
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
324+
\else\usebox{\pandoc@box}%
325+
\fi%
326+
}
327+
316328
\RequirePackage[font=small,labelfont=bf]{caption}
317329

318330
% Wide environments for figures and tables -------------------------------------

inst/rmarkdown/templates/rjournal/skeleton/RJournal.sty

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
% should be specified in RJwrapper.tex
1313

1414
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
15-
\ProvidesPackage{RJournal}[2025/05/07 v0.15 RJournal package]
15+
\ProvidesPackage{RJournal}[2025/07/15 v0.16 RJournal package]
1616

1717
\RequirePackage{tikz}
1818

@@ -313,6 +313,18 @@
313313

314314
% Figures ----------------------------------------------------------------------
315315

316+
% For use with pandoc > 3.2.1
317+
\newsavebox\pandoc@box
318+
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
319+
\sbox\pandoc@box{#1}%
320+
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
321+
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
322+
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
323+
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
324+
\else\usebox{\pandoc@box}%
325+
\fi%
326+
}
327+
316328
\RequirePackage[font=small,labelfont=bf]{caption}
317329

318330
% Wide environments for figures and tables -------------------------------------

inst/sample-article/RJournal.sty

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
% should be specified in RJwrapper.tex
1313

1414
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
15-
\ProvidesPackage{RJournal}[2025/05/07 v0.15 RJournal package]
15+
\ProvidesPackage{RJournal}[2025/07/15 v0.16 RJournal package]
1616

1717
\RequirePackage{tikz}
1818

@@ -313,6 +313,18 @@
313313

314314
% Figures ----------------------------------------------------------------------
315315

316+
% For use with pandoc > 3.2.1
317+
\newsavebox\pandoc@box
318+
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
319+
\sbox\pandoc@box{#1}%
320+
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
321+
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
322+
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
323+
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
324+
\else\usebox{\pandoc@box}%
325+
\fi%
326+
}
327+
316328
\RequirePackage[font=small,labelfont=bf]{caption}
317329

318330
% Wide environments for figures and tables -------------------------------------

inst/tex/RJournal.sty

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
% should be specified in RJwrapper.tex
1313

1414
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
15-
\ProvidesPackage{RJournal}[2025/05/07 v0.15 RJournal package]
15+
\ProvidesPackage{RJournal}[2025/07/15 v0.16 RJournal package]
1616

1717
\RequirePackage{tikz}
1818

@@ -313,6 +313,18 @@
313313

314314
% Figures ----------------------------------------------------------------------
315315

316+
% For use with pandoc > 3.2.1
317+
\newsavebox\pandoc@box
318+
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
319+
\sbox\pandoc@box{#1}%
320+
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
321+
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
322+
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
323+
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
324+
\else\usebox{\pandoc@box}%
325+
\fi%
326+
}
327+
316328
\RequirePackage[font=small,labelfont=bf]{caption}
317329

318330
% Wide environments for figures and tables -------------------------------------

tests/bad-article/RJournal.sty

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
% should be specified in RJwrapper.tex
1313

1414
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
15-
\ProvidesPackage{RJournal}[2025/05/07 v0.15 RJournal package]
15+
\ProvidesPackage{RJournal}[2025/07/15 v0.16 RJournal package]
1616

1717
\RequirePackage{tikz}
1818

@@ -313,6 +313,18 @@
313313

314314
% Figures ----------------------------------------------------------------------
315315

316+
% For use with pandoc > 3.2.1
317+
\newsavebox\pandoc@box
318+
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
319+
\sbox\pandoc@box{#1}%
320+
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
321+
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
322+
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
323+
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
324+
\else\usebox{\pandoc@box}%
325+
\fi%
326+
}
327+
316328
\RequirePackage[font=small,labelfont=bf]{caption}
317329

318330
% Wide environments for figures and tables -------------------------------------

0 commit comments

Comments
 (0)