Skip to content

Commit e48c367

Browse files
committed
new _support
1 parent 2eaaf1a commit e48c367

File tree

13 files changed

+245
-28
lines changed

13 files changed

+245
-28
lines changed

_support/latex/common.tex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,7 @@
5858
\newenvironment{todo}{%
5959
\begin{leftbar}\textsf{\textbf{To do}}\quad
6060
}{\end{leftbar}}
61+
62+
\newenvironment{important}{%
63+
\begin{leftbar}\textsf{\textbf{Important}}\quad
64+
}{\end{leftbar}}

_support/latex/sbabook/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
*.lol
88
*.lot
99
*.toc
10+
*.listing
11+
*.synctex.gz
1012
.auctex/
1113
/auto/
1214
sbabook*.pdf
15+
cover-*.pdf

_support/latex/sbabook/.gitrepo

Lines changed: 0 additions & 11 deletions
This file was deleted.

_support/latex/sbabook/.latexmkrc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# -*- mode: perl; -*-
2-
$pdflatex = 'lualatex --file-line-error %O %S';
3-
$pdf_mode = 1;
2+
$pdf_mode = 4; # luaLaTeX
3+
$postscript_mode = $dvi_mode = 0;
4+
$lualatex = 'lualatex --synctex=8 --interaction nonstopmode --file-line-error --halt-on-error %O %S';
5+
6+
# cleanup temporary files from listings.sty / tcolorbox.sty
7+
push @generated_exts, 'listing';
48

59
# extract git version info before each compile
610
system('./gitinfo2.sh > gitHeadLocal.gin');
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
\documentclass[english,twoside,openany,showtrims]{sbabook}
2+
3+
\pagelayout{\paperbackpage}
4+
5+
\usepackage[maketitle,foggy]{pharo-titlepage}
6+
\usepackage{hyperref}
7+
8+
\title{Book cover\titlebreak{}
9+
Exploration series}
10+
\author{Damien Pollet}
11+
\date{\today\titlebreak[\smallskip]{ -- }(version info)}
12+
13+
\begin{document}
14+
15+
\maketitle
16+
17+
\end{document}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
\documentclass[english,twoside,openany,showtrims]{sbabook}
2+
3+
\pagelayout{\paperbackpage}
4+
5+
\usepackage[maketitle,horizon]{pharo-titlepage}
6+
\usepackage{hyperref}
7+
8+
\title{Book cover\titlebreak{}
9+
Technology series}
10+
\author{Damien Pollet}
11+
\date{\today\titlebreak[\smallskip]{ -- }(version info)}
12+
13+
\begin{document}
14+
15+
\maketitle
16+
17+
\end{document}

_support/latex/sbabook/gitinfo2.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
#
3+
# Extract version info for use by the gitinfo2.sty package.
4+
#
5+
# Modified from gitinfo2's post-xxx-sample.txt file, to make it callable from
6+
# the build system instead of as a git hook, and to make it robust outside of a
7+
# git checkout.
8+
9+
# strict error handling
10+
set -o pipefail # trace ERR through pipes
11+
set -o errtrace # trace ERR through 'time command' and other functions
12+
set -o nounset # set -u : exit the script if you try to use an uninitialized variable
13+
set -o errexit # set -e : exit the script if any statement returns a non-true return value
14+
15+
function die() {
16+
status="$1"; shift
17+
echo "$0: ${*:-Error extracting version info}" >&2
18+
exit "$status"
19+
}
20+
21+
function silently() {
22+
"$@" > /dev/null 2>&1
23+
}
24+
25+
# Check that we're in a git repo with a proper HEAD commit, or bail out
26+
silently git rev-parse --is-inside-work-tree || die 0 "Not in a git repo"
27+
silently git rev-parse --verify HEAD || die 0 "No parent commit available"
28+
29+
# Get the first tag found in the history from the current HEAD
30+
FIRSTTAG=$(git describe --tags --always --dirty='-*' 2>/dev/null)
31+
# Get the first tag in history that looks like a Release
32+
RELTAG=$(git describe --tags --long --always --dirty='-*' --match '[0-9]*.*' 2>/dev/null)
33+
# Format git info as a LaTeX package load
34+
FMT="\
35+
\usepackage[%
36+
shash={%h},
37+
lhash={%H},
38+
authname={%an},
39+
authemail={%ae},
40+
authsdate={%ad},
41+
authidate={%ai},
42+
authudate={%at},
43+
commname={%an},
44+
commemail={%ae},
45+
commsdate={%ad},
46+
commidate={%ai},
47+
commudate={%at},
48+
refnames={%d},
49+
firsttagdescribe={$FIRSTTAG},
50+
reltag={$RELTAG}
51+
]{gitexinfo}
52+
"
53+
54+
# Hoover up the metadata
55+
git --no-pager log -1 --date=short --decorate=short --pretty=format:"$FMT" HEAD

_support/latex/sbabook/pharo-titlepage.sty

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
\ProvidesFile{pharo-titlepage.sty}
22
[2017/05/10 0.1 title page design for SBA booklets]
33

4+
% default titlepage appearance
5+
\newcommand\pharotitle@maketitle{\horizontitle}
6+
47
\DeclareOption{maketitle}{%
5-
\renewcommand{\maketitle}{\pharotitle}}
8+
\renewcommand{\maketitle}{\pharotitle@maketitle}}
9+
\DeclareOption{foggy}{%
10+
\renewcommand\pharotitle@maketitle{\foggytitle}}
11+
\DeclareOption{horizon}{%
12+
\renewcommand\pharotitle@maketitle{\horizontitle}}
613
\ProcessOptions
714

815
\RequirePackage{xcolor}
916
\RequirePackage{tikz}
1017
\usetikzlibrary{calc}
18+
\usetikzlibrary{shadings}
1119
\usetikzlibrary{svg.path}
1220

1321
% fixup TikZ page coordinates for memoir stock & trimming
@@ -40,11 +48,16 @@
4048
\definecolor{BeaconRed}{HTML}{ED1C24}
4149

4250
\definecolor{LightShade}{HTML}{EEEEEE}
51+
\definecolor{Shade}{HTML}{88AACC}
52+
53+
\colorlet{top}{LightShade}
54+
\colorlet{mid}{LightShade}
55+
\colorlet{bot}{PharoBlue}
4356

4457
\pgfdeclarelayer{background}
4558
\pgfsetlayers{background,main}
4659

47-
\newcommand\pharotitle{
60+
\newcommand\horizontitle{
4861
\thispagestyle{empty}
4962

5063
\begin{tikzpicture}[remember picture,overlay,line width=0mm]
@@ -108,7 +121,77 @@
108121
\newpage
109122
}
110123

111-
\newcommand\pharobeacon@tikz{
124+
\newcommand\foggytitle{
125+
\thispagestyle{empty}
126+
127+
\begin{tikzpicture}[remember picture,overlay,line width=0mm]
128+
\coordinate (left) at (current page.west);
129+
\coordinate (right) at (current page.east);
130+
\coordinate (top) at (current page.north);
131+
\coordinate (center) at (current page.center);
132+
\coordinate (bottom) at (current page.south);
133+
134+
\coordinate (stocktopleft) at ([left=\trimedge,above=\trimtop]current page.north west);
135+
\coordinate (stockbottomright) at ([right=\stockwidth,below=\stockheight]stocktopleft);
136+
137+
\coordinate (horizon) at ($ (center)!.618!(top) $);
138+
\coordinate (depths) at ($ (center)!.618!(bottom) $);
139+
140+
\newcommand\beaconscaling{(.618\paperheight/120pt)} % golden ratio factor & approx. height of beacon tower
141+
\coordinate (beacon) at ($ (depths -| left) + (-9.75,-2.5) $);
142+
143+
\node[anchor=north east] at ($ (horizon -| right) + (-.1\pagewidth,0cm) $) {
144+
\begin{varwidth}{.6\pagewidth}%
145+
\flushright \fontsize{50pt}{60pt}\sffamily
146+
\@title
147+
\end{varwidth}
148+
};
149+
150+
\node[anchor=south east] at ($ (depths -| right) + (-.1\pagewidth,1cm) $) {
151+
\begin{varwidth}{.8\pagewidth}%
152+
\flushright \HUGE\sffamily
153+
\@author
154+
\end{varwidth}
155+
};
156+
157+
\node[anchor=north east] at ($ (depths -| right) + (-.1\pagewidth,-.5cm) $) {
158+
\begin{varwidth}{.8\pagewidth}%
159+
\flushright \huge\sffamily\color{PharoDarkBlue}%
160+
\ifx\@empty\@series\else\@series\titlebreak\fi
161+
\@date
162+
\end{varwidth}
163+
};
164+
165+
\begin{pgfonlayer}{background}
166+
\shade[
167+
upper left = Shade, upper right = Shade!25!PharoBlue,
168+
lower left = LightShade!75!PharoBlue, lower right = LightShade
169+
] (stocktopleft) rectangle (depths -| stockbottomright);
170+
\shade[
171+
upper left = LightShade!75!PharoBlue, upper right = LightShade,
172+
lower left = PharoDarkBlue!75!Shade, lower right = PharoBlue
173+
] (depths -| stocktopleft) rectangle (stockbottomright);
174+
175+
\begin{scope}[
176+
transform canvas={shift=(beacon)},
177+
scale=\beaconscaling]
178+
179+
\pharobeacon@tikz[PharoBlue!75!PharoDarkBlue!75!Shade]
180+
181+
\end{scope}
182+
\end{pgfonlayer}
183+
\end{tikzpicture}
184+
\newpage
185+
}
186+
187+
\newcommand\pharobeacon@tikz[1][PharoBlue]{
188+
% vertical gradient along tower
189+
\pgfdeclareverticalshading{column}{100bp}{
190+
color(0)=(#1);
191+
color(40)=(#1);
192+
color(75)=(PharoRed);
193+
color(100)=(PharoRed)}
194+
112195
% beacon fire
113196
\shade[bottom color=BeaconRed, top color=BeaconOrange] svg {
114197
m 68.58,118.36 0,-14.22 22.72,0 0,15.14 -11.16,2.74 -11.56,-3.66

_support/latex/sbabook/sbabook.cls

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@
5656
Numbers=OldStyle
5757
]{Open Sans}
5858
\setmonofont[
59-
Scale=MatchLowercase
59+
Scale=MatchLowercase,
60+
HyphenChar={-} % enable hyphenation (disabled by default in mono fonts)
61+
% caveat: LuaLaTeX doesn't support changing the actual character
62+
% alternative solution: \usepackage[htt]{hyphenat}
6063
]{Fira Mono}%{Hack}
64+
6165
\let\codefamily\ttfamily
6266
\newcommand\textcode[1]{\texttt{#1}}
6367

@@ -304,6 +308,9 @@
304308
language = {#1}
305309
},
306310
breakable,
311+
lines before break = 4,
312+
before={\par\nobreak\@afterheading},
313+
after={\par\pagebreak[1]},
307314
frame code = {\draw
308315
([xshift=-2pt]interior.south west)
309316
--([xshift=-4pt]interior.south west)
@@ -392,6 +399,20 @@
392399
\renewcommand\listfigurename{Illustrations}
393400
\renewcommand\ext@table{lof}
394401

402+
%% Avoid ugly page breaks in contents / list of illustrations
403+
\newbool{captionsdefinedinchapter}
404+
\AfterEndEnvironment{figure}{\booltrue{captionsdefinedinchapter}}
405+
\AfterEndEnvironment{table}{\booltrue{captionsdefinedinchapter}}
406+
407+
\renewcommand\mempreaddparttotochook{\addtocontents{toc}{\protect\needspace{6\baselineskip}}}
408+
\renewcommand\mempreaddchaptertotochook{\addtocontents{toc}{\protect\needspace{3\baselineskip}}}
409+
\renewcommand\insertchapterspace{%
410+
\ifbool{captionsdefinedinchapter}
411+
{%
412+
\addtocontents{lof}{\protect\addvspace{10pt}\needspace{3\baselineskip}}%
413+
\boolfalse{captionsdefinedinchapter}%
414+
}{}}
415+
395416
%% figures & tables, like sections
396417
\cftsetindents{figure}{0pt}{0em}
397418
\let\cftfigurefont\cftsectionfont

_support/latex/sbabook/sbabook.tex

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
22

33
\pagelayout{\paperbackpage}
44

5+
\usepackage[useregional]{datetime2}
6+
7+
% extract info from git commit
8+
% requires gitinfo2 2.0.7, and below fix needed until 2.0.8 released
9+
\makeatletter
10+
\let\THEDAY\@dtm@currentday
11+
\let\THEMONTH\@dtm@currentmonth
12+
\let\THEYEAR\@dtm@currentyear
13+
\makeatother
14+
\usepackage[local,dirty=*]{gitinfo2}
15+
\usepackage{xstring}% \IfEq and \StrCut
16+
% a couple extensions...
17+
\makeatletter
18+
\newcommand\gitCommitInfo{%
19+
\IfEq{\gitRel}{}
20+
{commit \texttt{\gitAbbrevHash\gitDirty}}
21+
{\IfEq{\gitRoff}{0}
22+
{release \gitRel}
23+
{modified since release \gitRel{} --- commit \texttt{\gitAbbrevHash\gitDirty}}}}
24+
\newcommand\gitdate{\DTMusedate{gitdate}}
25+
\makeatother
26+
527
% \setotherlanguage{latin}
628
% \usepackage{lipsum}
729

@@ -18,6 +40,7 @@
1840
\title{the Square Bracket Associates\titlebreak{}
1941
\texorpdfstring{\protect\LaTeX}{LaTeX} book class}
2042
\author{Damien Pollet}
43+
\date{\gitdate\titlebreak[\smallskip]{ -- }\protect\gitCommitInfo}
2144

2245
\hypersetup{pdfinfo = {
2346
Title = {\thetitle},

0 commit comments

Comments
 (0)