Skip to content

Commit 05b11df

Browse files
committed
new sba
1 parent f8c2263 commit 05b11df

File tree

10 files changed

+298
-39
lines changed

10 files changed

+298
-39
lines changed

_support/latex/sbabook/.gitrepo

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; DO NOT EDIT (unless you know what you are doing)
2+
;
3+
; This subdirectory is a git "subrepo", and this file is maintained by the
4+
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
5+
;
6+
[subrepo]
7+
remote = https://github.com/cdlm/sbabook.git
8+
branch = master
9+
commit = 6ba943f40408c19528b5c62d5c498c9507e44335
10+
parent = d9663feb3a92f12b7cc6268e6cc41a5d6aef60da
11+
method = merge
12+
cmdver = 0.4.1

_support/latex/sbabook/.latexmkrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- mode: perl; -*-
22
$pdf_mode = 4; # luaLaTeX
33
$postscript_mode = $dvi_mode = 0;
4-
$lualatex = 'lualatex --synctex=8 --interaction nonstopmode --file-line-error --halt-on-error %O %S';
4+
$lualatex = 'lualatex --synctex=12 --interaction batchmode --file-line-error --halt-on-error %O %S';
55

66
# cleanup temporary files from listings.sty / tcolorbox.sty
77
push @generated_exts, 'listing';

_support/latex/sbabook/.travis.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
1-
sudo: required
2-
services:
3-
- docker
1+
version: "~> 1.0"
2+
env:
3+
global:
4+
- PATH=$HOME/texlive/bin/x86_64-linux:$PATH
5+
jobs:
6+
- TEXLIVE_RELEASE=rolling
7+
- TEXLIVE_RELEASE=2018
48

5-
before_install:
6-
- docker pull dpollet/texlive:base
9+
install:
10+
- ./ci/install-texlive
711

812
script:
9-
- docker run --tty --rm --volume $PWD:/work dpollet/texlive:base latexmk
13+
- latexmk
14+
15+
after_failure:
16+
- cat sbabook.log
1017

1118
deploy:
12-
- provider: releases
13-
api_key:
14-
secure: 0VV/C2lRToLm/PzZd4tVWOGGVjgRi11nj4VRw/D93Y1XTy2IWoyctWg/02OpZ+vzmMjT9dk/V2ZyfsYZT/dTSVT2HVPW8n4HSlBDqHhVaEGEKEd2YxLw/V1yVehco16gAtaDAFCZITW2Kod9hiIRoRTcInkCyT4zKrco6v7XmSY=
15-
skip_cleanup: true
16-
file: sbabook.pdf
17-
on:
18-
tags: true
19+
- provider: releases
20+
edge: true
21+
api_key:
22+
secure: tOQFCGi5LjrbGVGh22mQmLZvo6aAjw17pj6Hd2mpcgaMGwjNG7gBbvODFfuyCZMorVBwTu5YBk2QSXY9lk0xhmSfZ5XdPAh6foC/vP+y8XZzZV/YsrFR0yltGp6CFL7QtxoTiK3h7VmlD2gM8pgThG3N68Dy/tKxuSEednOOjBI=
23+
file: sbabook.pdf
24+
on:
25+
repo: cdlm/sbabook
26+
tags: true
27+
condition: $TEXLIVE_RELEASE = rolling

_support/latex/sbabook/README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Run `kpsexpand '$TEXMFHOME'` for a suggestion.
4040
## Requirements
4141

4242
You need a pretty up-to-date and complete LaTeX distribution, because the class requires LuaLaTeX and some associated packages to compile.
43-
Just get a full install of the latest [TeXlive release][tl] and you should be good.
43+
Check the `texlive*.deps` files, or just get a full install of the latest [TeXlive release][tl] and you should be good.
4444

4545
Fonts: the class uses [Gentium Book Basic][gentium], [Open Sans][], and [Fira mono][fira].
4646
Those are now distributed as part of TeXlive.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
4+
IFS=$'\n\t'
5+
# preamble from https://disconnected.systems/blog/another-bash-strict-mode/
6+
7+
function die() {
8+
echo "$@" >&2
9+
exit 1
10+
}
11+
12+
function texlive-repo() {
13+
[[ $# -eq 1 ]] || die "${FUNCNAME[0]}: No release specified (YYYY or rolling)"
14+
local release="$1"
15+
16+
if [[ "$release" = rolling ]]; then
17+
echo 'http://mirror.ctan.org/systems/texlive/tlnet'
18+
else
19+
[[ "$release" = [0-9][0-9][0-9][0-9] ]] || die "${FUNCNAME[0]}: incorrect release '$release'"
20+
echo "https://ftp.tu-chemnitz.de/pub/tug/historic/systems/texlive/${release}/tlnet-final/"
21+
# the rolling release is missing the shasum, and the tlnet directory
22+
# US mirror: http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/${release}/
23+
fi
24+
}
25+
26+
function deps-file() {
27+
if [[ "$1" = [0-9][0-9][0-9][0-9] ]]; then
28+
echo "texlive-$1.deps"
29+
else
30+
echo texlive.deps
31+
fi
32+
}
33+
34+
function texlive-release() {
35+
tlmgr --version \
36+
| grep 'TeX Live .*version' \
37+
| grep --only-matching '\d\d\d\d'
38+
}
39+
40+
# Ensure meaningful default values for required environment variables.
41+
# Override the full repository URL or set TEXLIVE_RELEASE to pick that year's frozen release.
42+
# Defaults to the current rolling release.
43+
: "${TEXLIVE_RELEASE:=rolling}"
44+
: "${TEXLIVE_REPOSITORY:="$(texlive-repo "$TEXLIVE_RELEASE")"}"
45+
: "${TEXLIVE_TARBALL:=install-tl-unx.tar.gz}"
46+
47+
function get-texlive-installer() {
48+
# download, checksum, extract
49+
curl --silent --location --remote-name-all "${TEXLIVE_REPOSITORY}/${TEXLIVE_TARBALL}"{,.sha512}
50+
shasum --check "${TEXLIVE_TARBALL}.sha512"
51+
tar --extract --gzip --file "${TEXLIVE_TARBALL}"
52+
}
53+
54+
function texlive-profile() {
55+
cat <<EOF
56+
selected_scheme scheme-basic
57+
58+
TEXDIR $HOME/texlive
59+
TEXMFLOCAL \$TEXDIR/texmf-local
60+
TEXMFSYSCONFIG \$TEXDIR/texmf-config
61+
TEXMFSYSVAR \$TEXDIR/texmf-var
62+
TEXMFCONFIG \$TEXMFSYSCONFIG
63+
TEXMFHOME \$TEXMFLOCAL
64+
TEXMFVAR \$TEXMFSYSVAR
65+
66+
instopt_adjustpath 0
67+
instopt_adjustrepo 0
68+
instopt_letter 0
69+
instopt_portable 0
70+
instopt_write18_restricted 1
71+
72+
# set repository:
73+
tlpdbopt_autobackup 0
74+
tlpdbopt_create_formats 1
75+
tlpdbopt_generate_updmap 0
76+
tlpdbopt_install_docfiles 0
77+
tlpdbopt_install_srcfiles 0
78+
tlpdbopt_post_code 1
79+
80+
EOF
81+
}
82+
83+
function install-texlive() {
84+
[[ $TRAVIS = true ]] || die "Should only run on Travis"
85+
echo "Downloading minimal TeXlive..."
86+
echo " release $TEXLIVE_RELEASE"
87+
echo " from $TEXLIVE_REPOSITORY"
88+
89+
get-texlive-installer
90+
91+
# find installer path from archive listing, sanity check
92+
local installer
93+
installer="$(tar --list --gzip --file "${TEXLIVE_TARBALL}" | grep '/install-tl$' )"
94+
[[ -x "$installer" ]] || die "can not find TeXlive installer at ${installer}";
95+
96+
texlive-profile >> texlive.profile
97+
"$installer" --repository "$TEXLIVE_REPOSITORY" --profile texlive.profile
98+
}
99+
100+
function install-deps() {
101+
xargs tlmgr install \
102+
latexmk \
103+
< "$(deps-file "$TEXLIVE_RELEASE")"
104+
}
105+
106+
# Only call the main function if this script was called as a command. This makes
107+
# it possible to source this script as a library.
108+
if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
109+
install-texlive
110+
install-deps
111+
fi

_support/latex/sbabook/gitinfo2.sh

100644100755
File mode changed.

_support/latex/sbabook/sbabook.cls

Lines changed: 72 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
\NeedsTeXFormat{LaTeX2e}
2-
\ProvidesClass{sbabook}[2013/03/08]
2+
\ProvidesClass{sbabook}[2020/02/28]
33

44
% \ExecuteOptions{a4paper,11pt,twoside}
55
\ProcessOptions*
@@ -42,25 +42,22 @@
4242
%%%
4343
%%% Fonts & paragraph typography
4444
%%%
45-
\RequirePackage{fontspec}
46-
47-
\setmainfont[
48-
Ligatures=TeX, % supposed to replace Mapping=tex-text
49-
UprightFont = {Gentium Book Basic},
50-
ItalicFont = {Gentium Book Basic Italic}
51-
]{Gentium Basic}
52-
\setsansfont[
45+
\RequirePackage{fontspec,gentium,opensans,FiraMono}
46+
47+
\setmainfont{Gentium Book Basic}
48+
\setsansfont{Open Sans}[
49+
\@ifpackagelater{opensans}{2019/06/19}% test for font naming bug
50+
{}% 2019/06/20 fixed it
51+
{BoldFont = {* Bold},}
5352
Scale=MatchLowercase,
54-
BoldFont = {* Bold},
55-
Ligatures=TeX,
5653
Numbers=OldStyle
57-
]{Open Sans}
58-
\setmonofont[
54+
]
55+
\setmonofont{Fira Mono}[
5956
Scale=MatchLowercase,
6057
HyphenChar={-} % enable hyphenation (disabled by default in mono fonts)
6158
% caveat: LuaLaTeX doesn't support changing the actual character
6259
% alternative solution: \usepackage[htt]{hyphenat}
63-
]{Fira Mono}%{Hack}
60+
]
6461

6562
\let\codefamily\ttfamily
6663
\newcommand\textcode[1]{\texttt{#1}}
@@ -251,6 +248,11 @@
251248
\setfloatadjustment{figure}{\small\sffamily\centering}
252249
\setfloatadjustment{table} {\small\sffamily\centering}
253250

251+
\usepackage{xtab}
252+
\newenvironment{fullwidthtabular}[1]{%
253+
\begin{xtabular*}{\textwidth}{@{}#1@{}}%
254+
}{\end{xtabular*}}
255+
254256
%%%
255257
%%% Graphics
256258
%%%
@@ -271,9 +273,55 @@
271273
%%%
272274
\RequirePackage{listings}
273275

274-
% \renewcommand{\lstlistlistingname}{Code examples}
276+
% declare unicode points to support in listings
277+
% see https://tex.stackexchange.com/a/25396
278+
\lst@InputCatcodes
279+
\def\lst@DefEC{%
280+
\lst@CCECUse \lst@ProcessLetter
281+
^^80^^81^^82^^83^^84^^85^^86^^87^^88^^89^^8a^^8b^^8c^^8d^^8e^^8f%
282+
^^90^^91^^92^^93^^94^^95^^96^^97^^98^^99^^9a^^9b^^9c^^9d^^9e^^9f%
283+
^^a0^^a1^^a2^^a3^^a4^^a5^^a6^^a7^^a8^^a9^^aa^^ab^^ac^^ad^^ae^^af%
284+
^^b0^^b1^^b2^^b3^^b4^^b5^^b6^^b7^^b8^^b9^^ba^^bb^^bc^^bd^^be^^bf%
285+
^^c0^^c1^^c2^^c3^^c4^^c5^^c6^^c7^^c8^^c9^^ca^^cb^^cc^^cd^^ce^^cf%
286+
^^d0^^d1^^d2^^d3^^d4^^d5^^d6^^d7^^d8^^d9^^da^^db^^dc^^dd^^de^^df%
287+
^^e0^^e1^^e2^^e3^^e4^^e5^^e6^^e7^^e8^^e9^^ea^^eb^^ec^^ed^^ee^^ef%
288+
^^f0^^f1^^f2^^f3^^f4^^f5^^f6^^f7^^f8^^f9^^fa^^fb^^fc^^fd^^fe^^ff%
289+
%
290+
^^^^20ac% EURO SIGN
291+
% french
292+
^^^^0152% LATIN CAPITAL LIGATURE OE
293+
^^^^0153% LATIN SMALL LIGATURE OE
294+
^^^^0178% LATIN CAPITAL LETTER Y WITH DIAERESIS
295+
% esperanto
296+
^^^^0108% LATIN CAPITAL LETTER C WITH CIRCUMFLEX
297+
^^^^0109% LATIN SMALL LETTER C WITH CIRCUMFLEX
298+
^^^^011c% LATIN CAPITAL LETTER G WITH CIRCUMFLEX
299+
^^^^011d% LATIN SMALL LETTER G WITH CIRCUMFLEX
300+
^^^^0124% LATIN CAPITAL LETTER H WITH CIRCUMFLEX
301+
^^^^0125% LATIN SMALL LETTER H WITH CIRCUMFLEX
302+
^^^^0134% LATIN CAPITAL LETTER J WITH CIRCUMFLEX
303+
^^^^0135% LATIN SMALL LETTER J WITH CIRCUMFLEX
304+
^^^^015c% LATIN CAPITAL LETTER S WITH CIRCUMFLEX
305+
^^^^015d% LATIN SMALL LETTER S WITH CIRCUMFLEX
306+
^^^^016c% LATIN CAPITAL LETTER U WITH BREVE
307+
^^^^016d% LATIN SMALL LETTER U WITH BREVE
308+
% serbian
309+
^^^^0106% LATIN CAPITAL LETTER C WITH ACUTE
310+
^^^^0107% LATIN SMALL LETTER C WITH ACUTE
311+
^^^^010c% LATIN CAPITAL LETTER C WITH CARON
312+
^^^^010d% LATIN SMALL LETTER C WITH CARON
313+
^^^^0110% LATIN CAPITAL LETTER D WITH STROKE
314+
^^^^0111% LATIN SMALL LETTER D WITH STROKE
315+
^^^^0160% LATIN CAPITAL LETTER S WITH CARON
316+
^^^^0161% LATIN SMALL LETTER S WITH CARON
317+
^^^^017d% LATIN CAPITAL LETTER Z WITH CARON
318+
^^^^017e% LATIN SMALL LETTER Z WITH CARON
319+
^^00}
320+
\lst@RestoreCatcodes
321+
275322
\lstdefinestyle{sbabook}{
276323
inputencoding=utf8,
324+
extendedchars=true,
277325
aboveskip=0pt, belowskip=0pt,
278326
columns=fullflexible,
279327
keepspaces,
@@ -285,6 +333,12 @@
285333
keywordstyle={},
286334
stringstyle={},
287335
commentstyle={},
336+
numberstyle = \tiny\ttfamily,
337+
numberblanklines = false,
338+
% numberfirstline = true,
339+
firstnumber = 1,
340+
stepnumber = 2, % number placement varies from listing to listing…
341+
numbersep = 7pt,
288342
}
289343
\lstset{style = sbabook}
290344

@@ -396,7 +450,6 @@
396450

397451
%% Combine figures, tables, listings into a single list. We redirect everything
398452
%% to the list of figures
399-
\renewcommand\listfigurename{Illustrations}
400453
\renewcommand\ext@table{lof}
401454

402455
%% Avoid ugly page breaks in contents / list of illustrations
@@ -468,4 +521,6 @@
468521
%%% Language, localizations, hyphenation
469522
%%%
470523
\RequirePackage{polyglossia}
471-
524+
\setmainlanguage{english}
525+
\addto\captionsenglish{%
526+
\renewcommand*\listfigurename{Illustrations}}

_support/latex/sbabook/sbabook.tex

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
\documentclass[english,twoside,openany,showtrims]{sbabook}
1+
\documentclass[twoside,openany,showtrims]{sbabook}
22

33
\pagelayout{\paperbackpage}
44

@@ -37,6 +37,7 @@
3737
\urlstyle{sf}
3838
\usepackage[unicode,breaklinks,hidelinks]{hyperref} % undecorated hyperlinks
3939

40+
4041
\title{the Square Bracket Associates\titlebreak{}
4142
\texorpdfstring{\protect\LaTeX}{LaTeX} book class}
4243
\author{Damien Pollet}
@@ -68,7 +69,7 @@
6869
\cleartoverso
6970
{\small
7071

71-
Copyright 2015 by Damien Pollet.
72+
Copyright 2015--2019 by Damien Pollet.
7273

7374
The contents of this book are protected under the Creative Commons
7475
Attribution-ShareAlike 3.0 Unported license.
@@ -211,13 +212,13 @@ \section{Font choices}
211212

212213
\begin{table}
213214
\caption{Fonts used in the document, and their roles}
214-
\begin{tabular}{ll}
215+
\begin{fullwidthtabular}{ll}
215216
\toprule
216217
\textnormal{Gentium -- \textit{Italic}} & Primary, paragraph text \\
217218
\textsf{Open Sans -- \textbf{Bold}} & Structural and secondary text: titles, captions \\
218219
\texttt{Fira Mono} & Verbatim text and code \\
219220
\bottomrule
220-
\end{tabular}
221+
\end{fullwidthtabular}
221222
\label{tab:fontRoles}
222223
\end{table}
223224

@@ -256,7 +257,7 @@ \section{Source code and listings}
256257

257258
\begin{table}
258259
\caption{Some convenient delimiters for inline code}
259-
\begin{tabular}{ll@{\qquad}ll}
260+
\begin{fullwidthtabular}{ll@{\qquad}ll}
260261
\toprule
261262
\code_\code|...|_ & pipe & \code\code§...§¶ & section sign \\
262263
\code|\code_..._| & underscore & \code§\code¶...¶§ & pilcrow \\
@@ -265,7 +266,7 @@ \section{Source code and listings}
265266
\code¿\code?...?¿ & question mark & \code`\code^...^` & circumflex \\
266267
\code?\code¿...¿? & inverse question mark & \code^\code`...`^ & backquote \\
267268
\bottomrule
268-
\end{tabular}
269+
\end{fullwidthtabular}
269270
\label{tab:codeDelims}
270271
\end{table}
271272

@@ -275,11 +276,13 @@ \section{Source code and listings}
275276
text, use the \code{displaycode} environment.
276277
You have to specify the language each excerpt of code is written in, as an
277278
argument; any language known to the \code{listings} package works.
279+
Also, as that example shows, some extended characters are supported in source code, provided they are encoded in precomposed form.
278280

279281
\begin{displaycode}{[Visual]Basic}
280282
10 PRINT "Hello SBAbook!"
281283
20 PRINT "This is a paragraph-level listing."
282-
25 PRINT "UTF-8 in Basic: élèves français, Ελλάδα, Здравствуй, мир!"
284+
25 PRINT "UTF-8: € Œuf cœur écrit en Français, izvršavanja, ελληνική γλώσσα, Здравствуй, мир!"
285+
26 PRINT "ankaŭ vi povas skribi esperante: ĈĉĜĝĤĥĴĵŬŭ"
283286
30 GOTO 10
284287
\end{displaycode}
285288

0 commit comments

Comments
 (0)