Skip to content

Commit

Permalink
add xtab and slantsc
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducasse committed Nov 13, 2020
1 parent b65337f commit 42b0762
Show file tree
Hide file tree
Showing 10 changed files with 298 additions and 39 deletions.
12 changes: 12 additions & 0 deletions _support/latex/sbabook/.gitrepo
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
;
[subrepo]
remote = https://github.com/cdlm/sbabook.git
branch = master
commit = 6ba943f40408c19528b5c62d5c498c9507e44335
parent = d9663feb3a92f12b7cc6268e6cc41a5d6aef60da
method = merge
cmdver = 0.4.1
2 changes: 1 addition & 1 deletion _support/latex/sbabook/.latexmkrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: perl; -*-
$pdf_mode = 4; # luaLaTeX
$postscript_mode = $dvi_mode = 0;
$lualatex = 'lualatex --synctex=8 --interaction nonstopmode --file-line-error --halt-on-error %O %S';
$lualatex = 'lualatex --synctex=12 --interaction batchmode --file-line-error --halt-on-error %O %S';

# cleanup temporary files from listings.sty / tcolorbox.sty
push @generated_exts, 'listing';
Expand Down
35 changes: 22 additions & 13 deletions _support/latex/sbabook/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
sudo: required
services:
- docker
version: "~> 1.0"
env:
global:
- PATH=$HOME/texlive/bin/x86_64-linux:$PATH
jobs:
- TEXLIVE_RELEASE=rolling
- TEXLIVE_RELEASE=2018

before_install:
- docker pull dpollet/texlive:base
install:
- ./ci/install-texlive

script:
- docker run --tty --rm --volume $PWD:/work dpollet/texlive:base latexmk
- latexmk

after_failure:
- cat sbabook.log

deploy:
- provider: releases
api_key:
secure: 0VV/C2lRToLm/PzZd4tVWOGGVjgRi11nj4VRw/D93Y1XTy2IWoyctWg/02OpZ+vzmMjT9dk/V2ZyfsYZT/dTSVT2HVPW8n4HSlBDqHhVaEGEKEd2YxLw/V1yVehco16gAtaDAFCZITW2Kod9hiIRoRTcInkCyT4zKrco6v7XmSY=
skip_cleanup: true
file: sbabook.pdf
on:
tags: true
- provider: releases
edge: true
api_key:
secure: tOQFCGi5LjrbGVGh22mQmLZvo6aAjw17pj6Hd2mpcgaMGwjNG7gBbvODFfuyCZMorVBwTu5YBk2QSXY9lk0xhmSfZ5XdPAh6foC/vP+y8XZzZV/YsrFR0yltGp6CFL7QtxoTiK3h7VmlD2gM8pgThG3N68Dy/tKxuSEednOOjBI=
file: sbabook.pdf
on:
repo: cdlm/sbabook
tags: true
condition: $TEXLIVE_RELEASE = rolling
2 changes: 1 addition & 1 deletion _support/latex/sbabook/README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Run `kpsexpand '$TEXMFHOME'` for a suggestion.
## Requirements

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

Fonts: the class uses [Gentium Book Basic][gentium], [Open Sans][], and [Fira mono][fira].
Those are now distributed as part of TeXlive.
Expand Down
111 changes: 111 additions & 0 deletions _support/latex/sbabook/ci/install-texlive
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/bin/bash
set -euo pipefail
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
IFS=$'\n\t'
# preamble from https://disconnected.systems/blog/another-bash-strict-mode/

function die() {
echo "$@" >&2
exit 1
}

function texlive-repo() {
[[ $# -eq 1 ]] || die "${FUNCNAME[0]}: No release specified (YYYY or rolling)"
local release="$1"

if [[ "$release" = rolling ]]; then
echo 'http://mirror.ctan.org/systems/texlive/tlnet'
else
[[ "$release" = [0-9][0-9][0-9][0-9] ]] || die "${FUNCNAME[0]}: incorrect release '$release'"
echo "https://ftp.tu-chemnitz.de/pub/tug/historic/systems/texlive/${release}/tlnet-final/"
# the rolling release is missing the shasum, and the tlnet directory
# US mirror: http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/${release}/
fi
}

function deps-file() {
if [[ "$1" = [0-9][0-9][0-9][0-9] ]]; then
echo "texlive-$1.deps"
else
echo texlive.deps
fi
}

function texlive-release() {
tlmgr --version \
| grep 'TeX Live .*version' \
| grep --only-matching '\d\d\d\d'
}

# Ensure meaningful default values for required environment variables.
# Override the full repository URL or set TEXLIVE_RELEASE to pick that year's frozen release.
# Defaults to the current rolling release.
: "${TEXLIVE_RELEASE:=rolling}"
: "${TEXLIVE_REPOSITORY:="$(texlive-repo "$TEXLIVE_RELEASE")"}"
: "${TEXLIVE_TARBALL:=install-tl-unx.tar.gz}"

function get-texlive-installer() {
# download, checksum, extract
curl --silent --location --remote-name-all "${TEXLIVE_REPOSITORY}/${TEXLIVE_TARBALL}"{,.sha512}
shasum --check "${TEXLIVE_TARBALL}.sha512"
tar --extract --gzip --file "${TEXLIVE_TARBALL}"
}

function texlive-profile() {
cat <<EOF
selected_scheme scheme-basic
TEXDIR $HOME/texlive
TEXMFLOCAL \$TEXDIR/texmf-local
TEXMFSYSCONFIG \$TEXDIR/texmf-config
TEXMFSYSVAR \$TEXDIR/texmf-var
TEXMFCONFIG \$TEXMFSYSCONFIG
TEXMFHOME \$TEXMFLOCAL
TEXMFVAR \$TEXMFSYSVAR
instopt_adjustpath 0
instopt_adjustrepo 0
instopt_letter 0
instopt_portable 0
instopt_write18_restricted 1
# set repository:
tlpdbopt_autobackup 0
tlpdbopt_create_formats 1
tlpdbopt_generate_updmap 0
tlpdbopt_install_docfiles 0
tlpdbopt_install_srcfiles 0
tlpdbopt_post_code 1
EOF
}

function install-texlive() {
[[ $TRAVIS = true ]] || die "Should only run on Travis"
echo "Downloading minimal TeXlive..."
echo " release $TEXLIVE_RELEASE"
echo " from $TEXLIVE_REPOSITORY"

get-texlive-installer

# find installer path from archive listing, sanity check
local installer
installer="$(tar --list --gzip --file "${TEXLIVE_TARBALL}" | grep '/install-tl$' )"
[[ -x "$installer" ]] || die "can not find TeXlive installer at ${installer}";

texlive-profile >> texlive.profile
"$installer" --repository "$TEXLIVE_REPOSITORY" --profile texlive.profile
}

function install-deps() {
xargs tlmgr install \
latexmk \
< "$(deps-file "$TEXLIVE_RELEASE")"
}

# Only call the main function if this script was called as a command. This makes
# it possible to source this script as a library.
if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
install-texlive
install-deps
fi
Empty file modified _support/latex/sbabook/gitinfo2.sh
100644 → 100755
Empty file.
89 changes: 72 additions & 17 deletions _support/latex/sbabook/sbabook.cls
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{sbabook}[2013/03/08]
\ProvidesClass{sbabook}[2020/02/28]

% \ExecuteOptions{a4paper,11pt,twoside}
\ProcessOptions*
Expand Down Expand Up @@ -42,25 +42,22 @@
%%%
%%% Fonts & paragraph typography
%%%
\RequirePackage{fontspec}

\setmainfont[
Ligatures=TeX, % supposed to replace Mapping=tex-text
UprightFont = {Gentium Book Basic},
ItalicFont = {Gentium Book Basic Italic}
]{Gentium Basic}
\setsansfont[
\RequirePackage{fontspec,gentium,opensans,FiraMono}

\setmainfont{Gentium Book Basic}
\setsansfont{Open Sans}[
\@ifpackagelater{opensans}{2019/06/19}% test for font naming bug
{}% 2019/06/20 fixed it
{BoldFont = {* Bold},}
Scale=MatchLowercase,
BoldFont = {* Bold},
Ligatures=TeX,
Numbers=OldStyle
]{Open Sans}
\setmonofont[
]
\setmonofont{Fira Mono}[
Scale=MatchLowercase,
HyphenChar={-} % enable hyphenation (disabled by default in mono fonts)
% caveat: LuaLaTeX doesn't support changing the actual character
% alternative solution: \usepackage[htt]{hyphenat}
]{Fira Mono}%{Hack}
]

\let\codefamily\ttfamily
\newcommand\textcode[1]{\texttt{#1}}
Expand Down Expand Up @@ -251,6 +248,11 @@
\setfloatadjustment{figure}{\small\sffamily\centering}
\setfloatadjustment{table} {\small\sffamily\centering}

\usepackage{xtab}
\newenvironment{fullwidthtabular}[1]{%
\begin{xtabular*}{\textwidth}{@{}#1@{}}%
}{\end{xtabular*}}

%%%
%%% Graphics
%%%
Expand All @@ -271,9 +273,55 @@
%%%
\RequirePackage{listings}

% \renewcommand{\lstlistlistingname}{Code examples}
% declare unicode points to support in listings
% see https://tex.stackexchange.com/a/25396
\lst@InputCatcodes
\def\lst@DefEC{%
\lst@CCECUse \lst@ProcessLetter
^^80^^81^^82^^83^^84^^85^^86^^87^^88^^89^^8a^^8b^^8c^^8d^^8e^^8f%
^^90^^91^^92^^93^^94^^95^^96^^97^^98^^99^^9a^^9b^^9c^^9d^^9e^^9f%
^^a0^^a1^^a2^^a3^^a4^^a5^^a6^^a7^^a8^^a9^^aa^^ab^^ac^^ad^^ae^^af%
^^b0^^b1^^b2^^b3^^b4^^b5^^b6^^b7^^b8^^b9^^ba^^bb^^bc^^bd^^be^^bf%
^^c0^^c1^^c2^^c3^^c4^^c5^^c6^^c7^^c8^^c9^^ca^^cb^^cc^^cd^^ce^^cf%
^^d0^^d1^^d2^^d3^^d4^^d5^^d6^^d7^^d8^^d9^^da^^db^^dc^^dd^^de^^df%
^^e0^^e1^^e2^^e3^^e4^^e5^^e6^^e7^^e8^^e9^^ea^^eb^^ec^^ed^^ee^^ef%
^^f0^^f1^^f2^^f3^^f4^^f5^^f6^^f7^^f8^^f9^^fa^^fb^^fc^^fd^^fe^^ff%
%
^^^^20ac% EURO SIGN
% french
^^^^0152% LATIN CAPITAL LIGATURE OE
^^^^0153% LATIN SMALL LIGATURE OE
^^^^0178% LATIN CAPITAL LETTER Y WITH DIAERESIS
% esperanto
^^^^0108% LATIN CAPITAL LETTER C WITH CIRCUMFLEX
^^^^0109% LATIN SMALL LETTER C WITH CIRCUMFLEX
^^^^011c% LATIN CAPITAL LETTER G WITH CIRCUMFLEX
^^^^011d% LATIN SMALL LETTER G WITH CIRCUMFLEX
^^^^0124% LATIN CAPITAL LETTER H WITH CIRCUMFLEX
^^^^0125% LATIN SMALL LETTER H WITH CIRCUMFLEX
^^^^0134% LATIN CAPITAL LETTER J WITH CIRCUMFLEX
^^^^0135% LATIN SMALL LETTER J WITH CIRCUMFLEX
^^^^015c% LATIN CAPITAL LETTER S WITH CIRCUMFLEX
^^^^015d% LATIN SMALL LETTER S WITH CIRCUMFLEX
^^^^016c% LATIN CAPITAL LETTER U WITH BREVE
^^^^016d% LATIN SMALL LETTER U WITH BREVE
% serbian
^^^^0106% LATIN CAPITAL LETTER C WITH ACUTE
^^^^0107% LATIN SMALL LETTER C WITH ACUTE
^^^^010c% LATIN CAPITAL LETTER C WITH CARON
^^^^010d% LATIN SMALL LETTER C WITH CARON
^^^^0110% LATIN CAPITAL LETTER D WITH STROKE
^^^^0111% LATIN SMALL LETTER D WITH STROKE
^^^^0160% LATIN CAPITAL LETTER S WITH CARON
^^^^0161% LATIN SMALL LETTER S WITH CARON
^^^^017d% LATIN CAPITAL LETTER Z WITH CARON
^^^^017e% LATIN SMALL LETTER Z WITH CARON
^^00}
\lst@RestoreCatcodes

\lstdefinestyle{sbabook}{
inputencoding=utf8,
extendedchars=true,
aboveskip=0pt, belowskip=0pt,
columns=fullflexible,
keepspaces,
Expand All @@ -285,6 +333,12 @@
keywordstyle={},
stringstyle={},
commentstyle={},
numberstyle = \tiny\ttfamily,
numberblanklines = false,
% numberfirstline = true,
firstnumber = 1,
stepnumber = 2, % number placement varies from listing to listing…
numbersep = 7pt,
}
\lstset{style = sbabook}

Expand Down Expand Up @@ -396,7 +450,6 @@

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

%% Avoid ugly page breaks in contents / list of illustrations
Expand Down Expand Up @@ -468,4 +521,6 @@
%%% Language, localizations, hyphenation
%%%
\RequirePackage{polyglossia}

\setmainlanguage{english}
\addto\captionsenglish{%
\renewcommand*\listfigurename{Illustrations}}
17 changes: 10 additions & 7 deletions _support/latex/sbabook/sbabook.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\documentclass[english,twoside,openany,showtrims]{sbabook}
\documentclass[twoside,openany,showtrims]{sbabook}

\pagelayout{\paperbackpage}

Expand Down Expand Up @@ -37,6 +37,7 @@
\urlstyle{sf}
\usepackage[unicode,breaklinks,hidelinks]{hyperref} % undecorated hyperlinks


\title{the Square Bracket Associates\titlebreak{}
\texorpdfstring{\protect\LaTeX}{LaTeX} book class}
\author{Damien Pollet}
Expand Down Expand Up @@ -68,7 +69,7 @@
\cleartoverso
{\small

Copyright 2015 by Damien Pollet.
Copyright 2015--2019 by Damien Pollet.

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

\begin{table}
\caption{Fonts used in the document, and their roles}
\begin{tabular}{ll}
\begin{fullwidthtabular}{ll}
\toprule
\textnormal{Gentium -- \textit{Italic}} & Primary, paragraph text \\
\textsf{Open Sans -- \textbf{Bold}} & Structural and secondary text: titles, captions \\
\texttt{Fira Mono} & Verbatim text and code \\
\bottomrule
\end{tabular}
\end{fullwidthtabular}
\label{tab:fontRoles}
\end{table}

Expand Down Expand Up @@ -256,7 +257,7 @@ \section{Source code and listings}

\begin{table}
\caption{Some convenient delimiters for inline code}
\begin{tabular}{ll@{\qquad}ll}
\begin{fullwidthtabular}{ll@{\qquad}ll}
\toprule
\code_\code|...|_ & pipe & \code\code§...§¶ & section sign \\
\code|\code_..._| & underscore & \code§\code¶...¶§ & pilcrow \\
Expand All @@ -265,7 +266,7 @@ \section{Source code and listings}
\code¿\code?...?¿ & question mark & \code`\code^...^` & circumflex \\
\code?\code¿...¿? & inverse question mark & \code^\code`...`^ & backquote \\
\bottomrule
\end{tabular}
\end{fullwidthtabular}
\label{tab:codeDelims}
\end{table}

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

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

Expand Down
Loading

0 comments on commit 42b0762

Please sign in to comment.