From 67abe57858ccacf663ad4a4468d9b2b132c692d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phaneDucasse?= Date: Tue, 27 Aug 2024 13:47:38 +0200 Subject: [PATCH] migrating to LaTeX 2023 --- .github/workflows/main.yml | 4 +- _support/latex/sbabook/.drone.yml | 109 ++++++++++++++++++++++ _support/latex/sbabook/.gitrepo | 8 +- _support/latex/sbabook/.travis.yml | 27 ------ _support/latex/sbabook/README.markdown | 5 +- _support/latex/sbabook/ci/install-texlive | 73 +++++++-------- _support/latex/sbabook/ci/list-deps | 100 ++++++++++++++++++++ _support/latex/sbabook/gitinfo2.sh | 0 _support/latex/sbabook/sbabook.bod.tex | 2 + _support/latex/sbabook/sbabook.cls | 22 ++++- _support/latex/sbabook/sbabook.spiral.tex | 1 + _support/latex/sbabook/sbabook.tex | 2 + _support/latex/sbabook/texlive-2023.deps | 70 ++++++++++++++ _support/latex/sbabook/texlive.deps | 52 +++++++++-- _support/latex/texlive.deps | 3 + 15 files changed, 389 insertions(+), 89 deletions(-) create mode 100644 _support/latex/sbabook/.drone.yml delete mode 100644 _support/latex/sbabook/.travis.yml create mode 100644 _support/latex/sbabook/ci/list-deps mode change 100755 => 100644 _support/latex/sbabook/gitinfo2.sh create mode 100644 _support/latex/sbabook/sbabook.bod.tex create mode 100644 _support/latex/sbabook/texlive-2023.deps create mode 100644 _support/latex/texlive.deps diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e04a9aa..f243341 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Book generation +name: Pillar >10 on: push: @@ -13,6 +13,6 @@ on: jobs: build: - uses: SquareBracketAssociates/BookBuilderDashboard/.github/workflows/main.yml@master + uses: SquareBracketAssociates/BookBuilderDashboard/.github/workflows/main.yml@newVersionOfPillar with: bookname: DynamicWebDev-wip diff --git a/_support/latex/sbabook/.drone.yml b/_support/latex/sbabook/.drone.yml new file mode 100644 index 0000000..374f5d9 --- /dev/null +++ b/_support/latex/sbabook/.drone.yml @@ -0,0 +1,109 @@ +--- +kind: pipeline +type: docker +name: TeXlive + +steps: + - name: build + image: texlive/texlive + commands: + - tlmgr option repository https://ctan.gutenberg-asso.fr/systems/texlive/tlnet + - tlmgr update --self --all + - latexmk sbabook + - latexmk sbabook.bod + - latexmk sbabook.spiral + + - name: build log + image: alpine + commands: + - cat sbabook.log + - cat sbabook.bod.log + - cat sbabook.spiral.log + when: + status: [failure, success] + +--- +kind: pipeline +type: docker +name: minimal TeXlive + +steps: + - name: build + image: texlive/texlive:latest-minimal + pull: always + commands: + - tlmgr option repository https://ctan.gutenberg-asso.fr/systems/texlive/tlnet + - tlmgr update --self --all + - tlmgr install latex-bin latexmk + - xargs tlmgr install < texlive.deps + - tlmgr path add + - latexmk sbabook + - latexmk sbabook.bod + - latexmk sbabook.spiral + + - name: build log + image: alpine + commands: + - cat sbabook.log + - cat sbabook.bod.log + - cat sbabook.spiral.log + when: + status: [failure, success] + +--- +kind: pipeline +type: docker +name: Ubuntu + TeXlive 2023 + +environment: + TEXLIVE_RELEASE: 2023 + +steps: + - name: build + image: ubuntu + commands: + - apt update && apt install -y curl perl + - export PATH=$HOME/texlive/bin/x86_64-linux:$HOME/texlive/bin/aarch64-linux:$PATH + - ./ci/install-texlive + - xargs tlmgr install < texlive-2023.deps + - latexmk sbabook + - latexmk sbabook.bod + - latexmk sbabook.spiral + + - name: build log + image: alpine + commands: + - cat sbabook.log + - cat sbabook.bod.log + - cat sbabook.spiral.log + when: + status: [failure, success] + +--- +kind: pipeline +type: docker +name: Ubuntu + TeXlive rolling + +environment: + TEXLIVE_RELEASE: rolling + +steps: + - name: build + image: ubuntu + commands: + - apt update && apt install -y curl perl + - export PATH=$HOME/texlive/bin/x86_64-linux:$HOME/texlive/bin/aarch64-linux:$PATH + - ./ci/install-texlive + - xargs tlmgr install < texlive.deps + - latexmk sbabook + - latexmk sbabook.bod + - latexmk sbabook.spiral + + - name: build log + image: alpine + commands: + - cat sbabook.log + - cat sbabook.bod.log + - cat sbabook.spiral.log + when: + status: [failure, success] diff --git a/_support/latex/sbabook/.gitrepo b/_support/latex/sbabook/.gitrepo index b8bd1d6..2dd199c 100644 --- a/_support/latex/sbabook/.gitrepo +++ b/_support/latex/sbabook/.gitrepo @@ -5,8 +5,8 @@ ; [subrepo] remote = https://github.com/cdlm/sbabook.git - branch = master - commit = 6ba943f40408c19528b5c62d5c498c9507e44335 - parent = d9663feb3a92f12b7cc6268e6cc41a5d6aef60da + branch = v0.2.8 + commit = ffabafecf60c20d856b706f9377595a45be7704f + parent = 45207449de0cce8a515afcfe358fabf185a14d30 method = merge - cmdver = 0.4.1 + cmdver = 0.4.6 diff --git a/_support/latex/sbabook/.travis.yml b/_support/latex/sbabook/.travis.yml deleted file mode 100644 index b473bdc..0000000 --- a/_support/latex/sbabook/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: "~> 1.0" -env: - global: - - PATH=$HOME/texlive/bin/x86_64-linux:$PATH - jobs: - - TEXLIVE_RELEASE=rolling - - TEXLIVE_RELEASE=2018 - -install: - - ./ci/install-texlive - -script: - - latexmk - -after_failure: - - cat sbabook.log - -deploy: - - 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 diff --git a/_support/latex/sbabook/README.markdown b/_support/latex/sbabook/README.markdown index e7fbe99..655c1bb 100644 --- a/_support/latex/sbabook/README.markdown +++ b/_support/latex/sbabook/README.markdown @@ -4,13 +4,12 @@ SBAbook — A LaTeX class for technical books This is a set of layout, typography, and markup definitions for LaTeX books based on the [memoir][] document class. It is intended for use by [Square Bracket Associates (SBA)][sba], and heavily customized in this direction — by this I mean it's made to setup specific semantic markup and typographic style, rather than to be flexible. -[![Build Status](https://travis-ci.org/cdlm/sbabook.svg?branch=master)](https://travis-ci.org/cdlm/sbabook) -[![Flattr this git repo](https://button.flattr.com/flattr-badge-large.png)](https://flattr.com/submit/auto?url=https%3A%2F%2Fgithub.com%2Fcdlm%2Fsbabook) +[![Donate](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/cdlm/donate "Donate using Liberapay") ## Usage (nearly there) -The preamble is limited to the minimum: +Here is the minimal preamble: ```latex \documentclass{sbabook} diff --git a/_support/latex/sbabook/ci/install-texlive b/_support/latex/sbabook/ci/install-texlive index 02f5fd1..eca7fca 100755 --- a/_support/latex/sbabook/ci/install-texlive +++ b/_support/latex/sbabook/ci/install-texlive @@ -4,6 +4,8 @@ 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/ +: "${TEXLIVE_TARBALL:=install-tl-unx.tar.gz}" + function die() { echo "$@" >&2 exit 1 @@ -11,49 +13,34 @@ function die() { function texlive-repo() { [[ $# -eq 1 ]] || die "${FUNCNAME[0]}: No release specified (YYYY or rolling)" - local release="$1" + local release="$1" url if [[ "$release" = rolling ]]; then - echo 'http://mirror.ctan.org/systems/texlive/tlnet' + url='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/" + url="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' + # resolve possible mirror to fixed URL + curl -LIs -o /dev/null -w '%{url_effective}' "$url" } -# 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() { + [[ $# -eq 1 ]] || die "Usage: ${FUNCNAME[0]} texlive-repo-url" + local repo="$1" + # download, checksum, extract - curl --silent --location --remote-name-all "${TEXLIVE_REPOSITORY}/${TEXLIVE_TARBALL}"{,.sha512} - shasum --check "${TEXLIVE_TARBALL}.sha512" + curl --silent --location --remote-name-all "${repo}/${TEXLIVE_TARBALL}"{,.sha512} + sha512sum --check "${TEXLIVE_TARBALL}.sha512" tar --extract --gzip --file "${TEXLIVE_TARBALL}" } function texlive-profile() { cat <> texlive.profile - "$installer" --repository "$TEXLIVE_REPOSITORY" --profile texlive.profile -} + "$installer" --repository "$repo" --profile texlive.profile + tlmgr option repository "$repo" -function install-deps() { - xargs tlmgr install \ - latexmk \ - < "$(deps-file "$TEXLIVE_RELEASE")" + tlmgr update --self --all + tlmgr install latex-bin latexmk } # 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 + # Override the full repository URL or set TEXLIVE_RELEASE to pick that year's frozen release. + # Defaults to the current rolling release. + release="${1:-${TEXLIVE_RELEASE:-rolling}}" + repo="${2:-${TEXLIVE_REPOSITORY:-$(texlive-repo "$release")}}" + + install-texlive "$release" "$repo" fi diff --git a/_support/latex/sbabook/ci/list-deps b/_support/latex/sbabook/ci/list-deps new file mode 100644 index 0000000..25dd1b8 --- /dev/null +++ b/_support/latex/sbabook/ci/list-deps @@ -0,0 +1,100 @@ +#!/usr/bin/env bash +set -o nounset +set -o errexit +set -o errtrace +set -o pipefail +IFS= +trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR + +shopt -s extglob +declare -A DEPS + +: "${TEXLIVE_REPOSITORY:=http://mirror.ctan.org/systems/texlive/tlnet}" +TEXLIVE_REPOSITORY="$(curl -LIs -o /dev/null -w '%{url_effective}' "$TEXLIVE_REPOSITORY")" +PREFIX="$(kpsewhich --var-value TEXMFROOT)" + +function die { + local code="${1:-1}" + [[ $# -ge 1 ]] && shift + + printf "$(tput setaf 1)%s$(tput sgr0)\n" "$@" 1>&2 + exit "$code" +} + +function info-inline { + printf "$(tput setaf 3)%s$(tput sgr0)" "$@" 1>&2 +} + +function info { + info-inline "$@" + printf "\n" 1>&2 +} + +function texlive-release() { + tlmgr --version \ + | sed '/^tlmgr/d ; s/.*version //' +} + +function filter-inputs { + sed -e '\#^INPUT '"$PREFIX"'/texmf-dist#!d' \ + -e 's#^INPUT '"$PREFIX"'/##' \ + "$@" +} + +function query-package-containing { + local filename="${1?}" + tlmgr --repository "$TEXLIVE_REPOSITORY" \ + search --global --file "$filename" \ + | sed '/^\t/d ; /^tlmgr:/d ; s/:$//' +} + +function list-package-files { + local pkgname="${1?}" + tlmgr --repository "$TEXLIVE_REPOSITORY" \ + info --list "$pkgname" \ + | sed '/^ /!d ; s/^ *//' +} + +function encache-file { + local filename="${1?}" pkgname + pkgname="$(query-package-containing "${filename}")" + while read -r provided; do + DEPS["$provided"]="$pkgname" + done < <(list-package-files "$pkgname") +} + +function package-name { + local filename="${1?}" + info-inline "$filename" + if [[ -z "${DEPS["$filename"]+found}" ]]; then + info " (querying ${TEXLIVE_REPOSITORY})" + encache-file "$filename" + echo "${DEPS["$filename"]}" || info "failed to resolve ${filename}" + else + info " (from ${DEPS[$filename]})" + fi +} + +function find-packages { + while read -r filename; do + package-name "$filename" + done +} + +function list-deps { + local main="${1:-main}" + main="${main%.@(tex|aux|fls)}" # extglob + [[ -f "$main.fls" ]] || die 1 "no such file: $main.fls" + + filter-inputs "$main.fls" | sort --unique > "$main.inputs" + info "$(wc -l "$main.inputs")" + + find-packages < "$main.inputs" | tee "$main.deps" + sort --unique --output "$main.deps" "$main.deps" +} + +# 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 + list-deps "$@" +fi diff --git a/_support/latex/sbabook/gitinfo2.sh b/_support/latex/sbabook/gitinfo2.sh old mode 100755 new mode 100644 diff --git a/_support/latex/sbabook/sbabook.bod.tex b/_support/latex/sbabook/sbabook.bod.tex new file mode 100644 index 0000000..a1617eb --- /dev/null +++ b/_support/latex/sbabook/sbabook.bod.tex @@ -0,0 +1,2 @@ +% Paper format for https://librairie.bod.fr +\providecommand{\setuppage}{\bodpage}\input{sbabook} diff --git a/_support/latex/sbabook/sbabook.cls b/_support/latex/sbabook/sbabook.cls index 5850bf2..2337e08 100644 --- a/_support/latex/sbabook/sbabook.cls +++ b/_support/latex/sbabook/sbabook.cls @@ -1,7 +1,6 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{sbabook}[2020/02/28] +\ProvidesClass{sbabook}[2024/03/18] -% \ExecuteOptions{a4paper,11pt,twoside} \ProcessOptions* \LoadClassWithOptions{memoir} @@ -19,17 +18,31 @@ \settrims{#1}{#1}% \advance\stockheight 2\trimtop \advance\stockwidth 2\trimedge} + +% Paper format for US trade paperback (e.g. Lulu) \newcommand{\paperbackpage}{ \stockustrade \setbleed{.125in} % \setbinding{5mm} \setlrmarginsandblock{.85in}{.65in}{*} \setulmarginsandblock{.75in}{.75in}{*}} + +% Paper format for office binding (both A4 and letter paper) \newcommand{\spiralboundpage}{ \stockaivus \setbleed{0pt}% trims not required (unless we deliver this via Lulu as well?) \setlrmarginsandblock{1.25in}{1.25in}{*} \setulmarginsandblock{.75in}{1in}{*}} + +% Paper format for https://librairie.bod.fr +\newcommand{\bodpage}{ + \setstocksize{220mm}{155mm} % final trimmed book dimensions + \setbleed{5mm} % additional paper, before trimming + \setlrmarginsandblock{.85in}{.65in}{*} + \setulmarginsandblock{.75in}{.75in}{*}} + +% Use this to select the page layout. +% Pass one of the above \FOOpage, or an equivalent custom macro \newcommand{\pagelayout}[1]{ \providecommand{\setuppage}{#1}% set default page layout \setuppage\checkandfixthelayout @@ -42,9 +55,9 @@ %%% %%% Fonts & paragraph typography %%% -\RequirePackage{fontspec,gentium,opensans,FiraMono} +\RequirePackage{fontspec,gentiumbook,opensans,FiraMono} -\setmainfont{Gentium Book Basic} +\setmainfont{Gentium Book Plus} \setsansfont{Open Sans}[ \@ifpackagelater{opensans}{2019/06/19}% test for font naming bug {}% 2019/06/20 fixed it @@ -489,7 +502,6 @@ %% verbatim setup \bvtopandtail % \bvsides \setlength{\bvboxsep}{.25em} -\tabson[4] \setverbatimfont{\normalfont\codefamily\small} \DeclareRobustCommand{\LaTeX}{% diff --git a/_support/latex/sbabook/sbabook.spiral.tex b/_support/latex/sbabook/sbabook.spiral.tex index 2327175..630cda9 100644 --- a/_support/latex/sbabook/sbabook.spiral.tex +++ b/_support/latex/sbabook/sbabook.spiral.tex @@ -1 +1,2 @@ +% Paper format for office binding (A4 or letter paper) \providecommand{\setuppage}{\spiralboundpage}\input{sbabook} diff --git a/_support/latex/sbabook/sbabook.tex b/_support/latex/sbabook/sbabook.tex index bc146b8..70ce50b 100644 --- a/_support/latex/sbabook/sbabook.tex +++ b/_support/latex/sbabook/sbabook.tex @@ -1,5 +1,7 @@ \documentclass[twoside,openany,showtrims]{sbabook} +% Setup paper format. +% Defaults to US trade paperback unless another format is already setup (see sbabook.*.tex) \pagelayout{\paperbackpage} \usepackage[useregional]{datetime2} diff --git a/_support/latex/sbabook/texlive-2023.deps b/_support/latex/sbabook/texlive-2023.deps new file mode 100644 index 0000000..6451341 --- /dev/null +++ b/_support/latex/sbabook/texlive-2023.deps @@ -0,0 +1,70 @@ +auxhook +bigintcalc +bitset +booktabs +cm +ctablestack +datetime2 +datetime2-english +environ +epstopdf-pkg +eso-pic +etoolbox +fira +fontaxes +fontspec +footmisc +gentium-tug +gettitlestring +gitinfo2 +graphics +graphics-cfg +graphics-def +hycolor +hyperref +iftex +infwarerr +intcalc +kvdefinekeys +kvoptions +kvsetkeys +l3backend +l3kernel +l3packages +latex +latexconfig +listings +ltxcmds +lua-uni-algos +lualibs +luaotfload +luatexbase +memoir +mptopdf +multirow +opensans +pdfcol +pdfescape +pdftexcmds +pgf +polyglossia +ragged2e +refcount +rerunfilecheck +stringenc +tcolorbox +tex-ini-files +textcase +tikzfill +tools +tracklang +trimspaces +unicode-data +uniquecounter +url +varwidth +xcolor +xkeyval +xpatch +xstring +xtab diff --git a/_support/latex/sbabook/texlive.deps b/_support/latex/sbabook/texlive.deps index 82efead..6451341 100644 --- a/_support/latex/sbabook/texlive.deps +++ b/_support/latex/sbabook/texlive.deps @@ -1,34 +1,70 @@ +auxhook +bigintcalc +bitset +booktabs +cm ctablestack datetime2 datetime2-english environ +epstopdf-pkg eso-pic -filehook +etoolbox fira +fontaxes fontspec footmisc gentium-tug +gettitlestring gitinfo2 graphics -hyphen-english -import +graphics-cfg +graphics-def +hycolor +hyperref +iftex +infwarerr +intcalc +kvdefinekeys +kvoptions +kvsetkeys +l3backend +l3kernel +l3packages +latex +latexconfig listings +ltxcmds +lua-uni-algos +lualibs +luaotfload luatexbase memoir +mptopdf multirow opensans +pdfcol +pdfescape +pdftexcmds pgf polyglossia +ragged2e +refcount +rerunfilecheck +stringenc tcolorbox +tex-ini-files +textcase +tikzfill tools tracklang trimspaces -ulem +unicode-data +uniquecounter +url varwidth xcolor +xkeyval +xpatch xstring xtab - -fontaxes -ragged2e -textcase diff --git a/_support/latex/texlive.deps b/_support/latex/texlive.deps new file mode 100644 index 0000000..04d329a --- /dev/null +++ b/_support/latex/texlive.deps @@ -0,0 +1,3 @@ +amsmath +import +ulem \ No newline at end of file