Skip to contentSkip to conversation

utilities/autodate.sh: Make newer tcolorbox behave as before

PATCH Applied Akira Yokosawa 2 participants 2 messages Oct 24, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 utilities/autodate.sh: Make newer tcolorbox behave as before

Date: Sun, 4 Oct 2020 18:57:55 +0900
Subject: [PATCH perfbook] utilities/autodate.sh: Make newer tcolorbox behave as before

tcolorbox 4.40 or later has wider skips around its boxes by default.

Putting \tcbsetforeverylayer{autoparskip} in preamble restores the previous default behavior [1].

It needs to be put conditionally because the command changes older tcolorbox's behavior.

We use a lot of booleans for conditional things in perfbook, but their values are changed based on targets such as -1c, -nq, -qq, etc. However, version of tcolorbox is common to all the targets. We need a different way to put the \tcbsetforeverylayer{} command.

As autodate.tex is included in the preamble of perfbook, we can do this by adding some script in autodate.sh, which will generate the command when a newer tcolorbox is found.

Also update Makefile to let autodate.tex depend on autodate.sh.

[1]: https://www.ctan.org/ctan-ann/id/[email protected]

---
Hi Paul,

I have kept this one on hold for a couple of weeks. perfbook can be built without this change, but the wider skips around Quick Quizzes looked waste of space for me.

This change actually restores the exact behavior of older tcolorbox.

Thanks, Akira
--

 Makefile              |  2 +-
 utilities/autodate.sh | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
Makefile +1 -1
index a3f98442..73b5767e 100644
@@ -204,7 +204,7 @@ ifeq ($(NEWTXTEXT),)
 endif
 	sh utilities/runfirstlatex.sh $(basename $@)
 
-autodate.tex: perfbook-lt.tex $(LATEXSOURCES) $(BIBSOURCES) $(SVGSOURCES) $(FIGSOURCES) $(DOTSOURCES) $(EPSORIGIN) $(SOURCES_OF_SNIPPET) $(GITREFSTAGS) utilities/fcvextract.pl
+autodate.tex: perfbook-lt.tex $(LATEXSOURCES) $(BIBSOURCES) $(SVGSOURCES) $(FIGSOURCES) $(DOTSOURCES) $(EPSORIGIN) $(SOURCES_OF_SNIPPET) $(GITREFSTAGS) utilities/fcvextract.pl utilities/autodate.sh
 	sh utilities/autodate.sh >autodate.tex
 
 perfbook_flat.tex: autodate.tex $(PDFTARGETS_OF_EPS) $(PDFTARGETS_OF_SVG) $(FCVSNIPPETS) $(FCVSNIPPETS_VIA_LTMS)
utilities/autodate.sh +10 -0
index 2b76d33b..7bd7cbb8 100644
@@ -94,3 +94,13 @@ env printf '\\date{%s %s, %s %s %s}\n' $month $day $year "$release" $modified
 env printf '\\newcommand{\\commityear}{%s}\n' $year
 env printf '\\newcommand{\\commitid}{%s}\n' $commitid$modified
 env printf '\\IfQqzBg{}{\\setboolean{qqzbg}{%s}}\n' $qqzbg
+
+# command for newer tcolorbox (4.40 or later) to have backward-compatible skips
+tcolorbox_sty=`kpsewhich tcolorbox.sty`
+tcbversion=`grep ProvidesPackage $tcolorbox_sty | sed -e 's/.*version \([0-9]\+\.[0-9]\+\).*/\1/g'`
+tcbold=4.39
+env printf '%% tcolorbox version: %s\n' $tcbversion
+if [ $(echo $tcbversion $tcbold | awk '{if ($1 > $2) print 1;}') ] ;
+then
+	env printf '\\tcbsetforeverylayer{autoparskip}\n';
+fi
Signature · 1 line
2.17.1
#1 lore raw
Quoted 25 lines · Akira Yokosawa

Date: Sun, 4 Oct 2020 18:57:55 +0900
Subject: [PATCH perfbook] utilities/autodate.sh: Make newer tcolorbox behave as before

tcolorbox 4.40 or later has wider skips around its boxes by default.

Putting \tcbsetforeverylayer{autoparskip} in preamble restores the previous default behavior [1].

It needs to be put conditionally because the command changes older tcolorbox's behavior.

We use a lot of booleans for conditional things in perfbook, but their values are changed based on targets such as -1c, -nq, -qq, etc. However, version of tcolorbox is common to all the targets. We need a different way to put the \tcbsetforeverylayer{} command.

As autodate.tex is included in the preamble of perfbook, we can do this by adding some script in autodate.sh, which will generate the command when a newer tcolorbox is found.

Also update Makefile to let autodate.tex depend on autodate.sh.

[1]: https://www.ctan.org/ctan-ann/id/[email protected]

Quoted 8 lines

---
Hi Paul,

I have kept this one on hold for a couple of weeks. perfbook can be built without this change, but the wider skips around Quick Quizzes looked waste of space for me.

This change actually restores the exact behavior of older tcolorbox.

Queued and pushed, thank you!!!

No difference at this end, but that is to be expected, given that my setup still uses an older version of tcolorbox. ;-)

Thanx, Paul

Quoted 40 lines

Thanks, Akira
--

 Makefile              |  2 +-
 utilities/autodate.sh | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
Makefile +1 -1
index a3f98442..73b5767e 100644
@@ -204,7 +204,7 @@ ifeq ($(NEWTXTEXT),)
 endif
 	sh utilities/runfirstlatex.sh $(basename $@)
 
-autodate.tex: perfbook-lt.tex $(LATEXSOURCES) $(BIBSOURCES) $(SVGSOURCES) $(FIGSOURCES) $(DOTSOURCES) $(EPSORIGIN) $(SOURCES_OF_SNIPPET) $(GITREFSTAGS) utilities/fcvextract.pl
+autodate.tex: perfbook-lt.tex $(LATEXSOURCES) $(BIBSOURCES) $(SVGSOURCES) $(FIGSOURCES) $(DOTSOURCES) $(EPSORIGIN) $(SOURCES_OF_SNIPPET) $(GITREFSTAGS) utilities/fcvextract.pl utilities/autodate.sh
 	sh utilities/autodate.sh >autodate.tex
 
 perfbook_flat.tex: autodate.tex $(PDFTARGETS_OF_EPS) $(PDFTARGETS_OF_SVG) $(FCVSNIPPETS) $(FCVSNIPPETS_VIA_LTMS)
utilities/autodate.sh +10 -0
index 2b76d33b..7bd7cbb8 100644
@@ -94,3 +94,13 @@ env printf '\\date{%s %s, %s %s %s}\n' $month $day $year "$release" $modified
 env printf '\\newcommand{\\commityear}{%s}\n' $year
 env printf '\\newcommand{\\commitid}{%s}\n' $commitid$modified
 env printf '\\IfQqzBg{}{\\setboolean{qqzbg}{%s}}\n' $qqzbg
+
+# command for newer tcolorbox (4.40 or later) to have backward-compatible skips
+tcolorbox_sty=`kpsewhich tcolorbox.sty`
+tcbversion=`grep ProvidesPackage $tcolorbox_sty | sed -e 's/.*version \([0-9]\+\.[0-9]\+\).*/\1/g'`
+tcbold=4.39
+env printf '%% tcolorbox version: %s\n' $tcbversion
+if [ $(echo $tcbversion $tcbold | awk '{if ($1 > $2) print 1;}') ] ;
+then
+	env printf '\\tcbsetforeverylayer{autoparskip}\n';
+fi
Signature · 1 line
2.17.1