refactor: CI and nix (#306)

* fix: remove custom fonts

Since they are available in Nix, there is no need to keep them in the project anymore

* chore: remove old obsolete files

* refactor: rewrite Nix files

- Switch from `numtide/flake-utils` to `flake-parts`
- Add custom font derivation for LaTeX
- Add `formatter`
- Switch to `python311`

* ci: update Github workflows

* feat: add `Makefile` for local development

Very useful when used in combination with `nix develop`

* feat: add `.envrc` file for loading development environment with `nix-direnv`

* feat: add `.editorconfig` and `.prettierrc`

* style: reformat files using `prettier`

Run `nix run nixpkgs#nodePackages.prettier -- --write .`

* fix: add workaround to prevent bug with `minted` package

see https://github.com/gpoore/minted/issues/353 for context

* fix: add `version.tex` in the repo

* chore: rewrite `README`

* chore: ignore LaTeX temporary files while building locally

* feat: add `latexindent.pl` configuration file

* style: lint LaTeX files
This commit is contained in:
Pol Dellaiera 2023-02-02 10:53:45 +01:00 committed by GitHub
parent 98b71ac267
commit de799935b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
124 changed files with 2408 additions and 2272 deletions

21
.editorconfig Normal file
View File

@ -0,0 +1,21 @@
root = true
[*]
indent_size = 4
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[Makefile]
indent_style = tab
[*.{tex,cls,lua,nix}]
indent_style = space
indent_size = 2
max_line_length = 80
[*.md]
trim_trailing_whitespace = false
indent_size = 2
max_line_length = 80

2
.envrc Normal file
View File

@ -0,0 +1,2 @@
use flake .
use flake github:loophp/nix-prettier

51
.github/settings.yml vendored Normal file
View File

@ -0,0 +1,51 @@
# https://github.com/probot/settings
branches:
- name: master
protection:
enforce_admins: false
required_pull_request_reviews:
dismiss_stale_reviews: true
require_code_owner_reviews: true
required_approving_review_count: 1
restrictions: null
required_linear_history: true
required_status_checks:
strict: true
labels:
- name: typo
color: ee0701
- name: dependencies
color: 0366d6
- name: enhancement
color: 0e8a16
- name: question
color: cc317c
- name: security
color: ee0701
- name: stale
color: eeeeee
repository:
allow_merge_commit: true
allow_rebase_merge: true
allow_squash_merge: true
default_branch: master
description:
"Bartosz Milewski's 'Category Theory for Programmers' unofficial PDF and
LaTeX sources"
homepage: https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/
topics: pdf,haskell,scala,latex,cpp,functional-programming,ocaml,category-theory
has_downloads: true
has_issues: true
has_pages: false
has_projects: false
has_wiki: false
name: milewski-ctfp-pdf
private: false

View File

@ -1,117 +0,0 @@
name: Build PDFs
on:
- push
jobs:
dependencies:
name: Build dependencies
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Set up Git repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Create global variables
id: version
run: echo "::set-output name=version::$(git rev-parse --short HEAD)"
determine-matrix:
name: Figure out the packages we need to build
runs-on: ubuntu-latest
needs: [dependencies]
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Set up Git repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Install the Nix package manager
uses: cachix/install-nix-action@v16
- id: set-matrix
run: |
echo "::set-output name=matrix::$(
nix eval --json --impure \
--expr 'builtins.attrNames (import ./.).packages.x86_64-linux'
)"
build:
name: Build documents
needs: determine-matrix
runs-on: ubuntu-latest
strategy:
matrix:
packages: ${{fromJson(needs.determine-matrix.outputs.matrix)}}
steps:
- name: Set up Git repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Install Nix
uses: cachix/install-nix-action@v16
- name: Build ${{ matrix.packages }}.pdf
run: |
nix build .#${{ matrix.packages }}
mkdir -p out
cp -ar ./result/* out/
- name: Upload build assets (${{ matrix.packages }}.pdf)
uses: actions/upload-artifact@v2
with:
name: ctfp
path: out/*
release:
name: "Create Github tag/pre-release"
runs-on: ubuntu-latest
needs: [dependencies, build]
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Github pre-release (${{ needs.dependencies.outputs.version }})
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}-${{ needs.dependencies.outputs.version }}
release_name: Version ${{ github.run_number }} (${{ needs.dependencies.outputs.version }})
draft: false
prerelease: true
assets:
name: Upload release assets
runs-on: ubuntu-latest
needs: [determine-matrix, dependencies, release]
strategy:
matrix:
packages: ${{fromJson(needs.determine-matrix.outputs.matrix)}}
steps:
- name: Download build assets (${{ matrix.packages }}.pdf)
uses: actions/download-artifact@v2
with:
name: ctfp
path: ctfp
- name: Upload release assets (${{ matrix.packages }}--${{ needs.dependencies.outputs.version }}.pdf)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ctfp/${{ matrix.packages }}.pdf
asset_name: ${{ matrix.packages }}--${{ needs.dependencies.outputs.version }}.pdf
asset_content_type: application/pdf

64
.github/workflows/nix-flake-check.yaml vendored Normal file
View File

@ -0,0 +1,64 @@
name: Check and build
on:
pull_request:
push:
branches:
- master
jobs:
dependencies:
name: Build dependencies
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Set up Git repository
uses: actions/checkout@v3
- name: Create global variables
id: version
run:
echo "version=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
determine-matrix:
name: Figure out the packages we need to build
runs-on: ubuntu-latest
needs: [dependencies]
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Set up Git repository
uses: actions/checkout@v3
- name: Install the Nix package manager
uses: cachix/install-nix-action@v18
- id: set-matrix
run: |
echo "matrix=$(
nix eval --json .#packages.x86_64-linux --apply builtins.attrNames
)" >> $GITHUB_OUTPUT
build:
name: Build
needs: determine-matrix
runs-on: ubuntu-latest
strategy:
matrix:
packages: ${{fromJson(needs.determine-matrix.outputs.matrix)}}
steps:
- name: Set up Git repository
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v18
- name: Nix flake check
run: nix flake check
- name: Build ${{ matrix.packages }}.pdf
run: nix build .#${{ matrix.packages }}

17
.github/workflows/nix-fmt-checks.yaml vendored Normal file
View File

@ -0,0 +1,17 @@
name: Nix formatter checks
on:
pull_request:
jobs:
format-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v18
- name: Run nix formatter tool
run: nix fmt . -- --check

18
.github/workflows/prettier-checks.yaml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Prettier checks
on:
pull_request:
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install the Nix package manager
uses: cachix/install-nix-action@v18
- name: Checks
run: nix run nixpkgs#nodePackages.prettier -- --check .

99
.github/workflows/release.yaml vendored Normal file
View File

@ -0,0 +1,99 @@
name: Release PDFs
on:
push:
tags:
- "**"
jobs:
determine-matrix:
name: Figure out the assets we need to build
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Set up Git repository
uses: actions/checkout@v3
- name: Install the Nix package manager
uses: cachix/install-nix-action@v18
- id: set-matrix
run: |
echo "matrix=$(
nix eval --json --impure \
--expr 'builtins.filter (x: (null == builtins.match "(.*)-nts" x)) (builtins.attrNames (import ./.).packages.x86_64-linux)'
)" >> $GITHUB_OUTPUT
build:
name: Build documents
needs: determine-matrix
runs-on: ubuntu-latest
strategy:
matrix:
packages: ${{fromJson(needs.determine-matrix.outputs.matrix)}}
steps:
- name: Set up Git repository
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v18
- name: Build ${{ matrix.packages }}.pdf
run: |
nix build .#${{ matrix.packages }}
mkdir -p out
cp -ar ./result/* out/
- name: Upload build assets (${{ matrix.packages }}.pdf)
uses: actions/upload-artifact@v2
with:
name: ctfp
path: out/*
release:
name: "Create Github pre-release"
runs-on: ubuntu-latest
needs: [build]
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Github pre-release (${{ github.ref }})
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
assets:
name: Upload release assets
runs-on: ubuntu-latest
needs: [determine-matrix, release]
strategy:
matrix:
packages: ${{fromJson(needs.determine-matrix.outputs.matrix)}}
steps:
- name: Download build assets (${{ matrix.packages }}.pdf)
uses: actions/download-artifact@v2
with:
name: ctfp
path: ctfp
- name:
Upload release assets (${{ matrix.packages }}--${{ github.ref
}}.pdf)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ctfp/${{ matrix.packages }}.pdf
asset_name: ${{ matrix.packages }}--${{ github.ref }}.pdf
asset_content_type: application/pdf

28
.gitignore vendored
View File

@ -1,16 +1,26 @@
.vscode/
*.fls
/.vscode/
/.direnv/
/build/
/result
.DS_Store
src/.dotty-ide-disabled
src/.metals
out/
_minted*
*.fdb_latexmk
*.fls
out/*
*.fdb_latexmk
*.bak*
*.log
*.pdf
*.xdv
*.gz
src/version.tex
*.pyg
*.synctex(busy)
src/.dotty-ide-disabled
venv/*
.DS_Store
src/.metals
out/
*.aux
*.idx
*.ilg
*.lig
*.ind
*.out
*.toc

7
.latexindent.yaml Normal file
View File

@ -0,0 +1,7 @@
defaultIndent: " "
verbatimEnvironments:
verbatim: 1
lstlisting: 1
minted: 1
snip: 1
snipv: 1

6
.prettierignore Normal file
View File

@ -0,0 +1,6 @@
/.direnv/
/.idea/
/vendor/
/docs/
/build/
CHANGELOG.md

3
.prettierrc Normal file
View File

@ -0,0 +1,3 @@
{
"proseWrap": "always"
}

View File

@ -1,32 +0,0 @@
language:
- nix
script:
- nix-shell --pure --command 'cd src; make all'
cache:
directories:
src/_minted-ctfp
deploy:
- provider: releases
api_key:
secure: usNWQZc/HcrZxR72+Qz2YXeyf56h0EwLVl6oOXIivxTWQCTTQ0cE6tXG6lP8JxQ1qlfAhbdh4QOmz6jxQD60HxsUwDWmt9t51o+8n3EMeID0hc45ES40/mbieUfR1jbkLbwmL16Z/bWsvUErmGuUgOxYrUCplK9fWs7Vvt8xmReFdunw8XpVrywG4rl1jXDo9YWihMps5KLOqd3mY3yvlxAmB+UKkhHPNdcEuEghEBhC8HZoZkFiwfRw/8PeOh9VpnQ2ht9eDXOlB7zNYY9Xr/S98FbzfZXxFjApXVRgNP8k2UYyHn8HCmIoCSs+Jv06tEvNCuwTvj0JNsuoW7vu/Q7wrrpScfDL+WnSw2CScml+xAe7Q4caoZKkzaMCnj5fHbPEZ731+SLZNbG6TMTYhMqhFm0Fr87bwdNlayqAssIhOwU4ca3pnZOQFO4vNOWblNfbHsX5F9sJDOR0uD4Y+PgfNWgTsssXqei7owBJNTe+qz5Q7IaFA3A8EMp57CV1dUCgmjxVuugtz6DLpl16WGiWpqakIA900GXMG+2c4ENCCDWmYtGlpWs2lSBqRYHV1gncE8UGtIih8G6g5jQd2aJUQKHKuaEiv/28WLI7f2exUuOBmc0ce4xP+qZAs5XWiPo4jJLNyb81uNIZ0jCb/c5+lEH8EsYF+jFOrmw17GQ=
file: out/**/*.pdf
file_glob: true
skip_cleanup: true
on:
repo: hmemcpy/milewski-ctfp-pdf
branch: master
tags: true
- provider: s3
bucket: milewski-ctfp-pdf
access_key_id: '$ARTIFACTS_KEY'
secret_access_key: '$ARTIFACTS_SECRET'
region: us-east-1
acl: public_read
local_dir: out
skip_cleanup: true
on:
all_branches: true
repo: hmemcpy/milewski-ctfp-pdf

31
Makefile Normal file
View File

@ -0,0 +1,31 @@
OUTPUT ?= $(shell basename "$(shell dirname "$(INPUT)")")
OUTPUT_DIRECTORY = $(shell pwd)/build
LATEXMK_ARGS ?= -f -file-line-error -shell-escape -logfilewarninglist -interaction=nonstopmode -halt-on-error -norc -pdflatex="xelatex %O %S" -pdfxe
TEXINPUTS = ""
TEXLIVE_RUN = TEXINPUTS=$(TEXINPUTS)
LATEXMK_COMMAND = $(TEXLIVE_RUN) latexmk $(LATEXMK_ARGS)
# Make does not offer a recursive wildcard function, so here's one:
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
ctfp:
cd src; $(LATEXMK_COMMAND) -jobname=ctfp ctfp-reader.tex
ctfp-ocaml:
cd src; $(LATEXMK_COMMAND) -jobname=ctfp-ocaml ctfp-reader-ocaml.tex
ctfp-scala:
cd src; $(LATEXMK_COMMAND) -jobname=ctfp-scala ctfp-reader-scala.tex
ctfp-print:
cd src; $(LATEXMK_COMMAND) -jobname=ctfp-print ctfp-print.tex
ctfp-print-ocaml:
cd src; $(LATEXMK_COMMAND) -jobname=ctfp-print-ocaml ctfp-print-ocaml.tex
ctfp-print-scala:
cd src; $(LATEXMK_COMMAND) -jobname=ctfp-print-scala ctfp-print-scala.tex
lint:
$(foreach file, $(call rwildcard,$(shell dirname "$(INPUT)"),*.tex), latexindent -l -w $(file);)

140
README.md
View File

@ -1,76 +1,106 @@
Category Theory for Programmers
====
![image](https://user-images.githubusercontent.com/601206/43392303-f770d7be-93fb-11e8-8db8-b7e915b435ba.png)
<b>Direct link: [category-theory-for-programmers.pdf](https://github.com/hmemcpy/milewski-ctfp-pdf/releases/download/v1.3.0/category-theory-for-programmers.pdf)</b>
(Latest release: v1.3.0, August 2019. See [releases](https://github.com/hmemcpy/milewski-ctfp-pdf/releases) for additional formats and languages.)
![GitHub stars][github stars]
[![GitHub Workflow Status][github workflow status]][github actions link]
[![Download][download badge]][github latest release]
[![License][license badge]][github latest release]
[![Build Status](https://travis-ci.org/hmemcpy/milewski-ctfp-pdf.svg?branch=master)](https://travis-ci.org/hmemcpy/milewski-ctfp-pdf)
[(latest CI build)](https://s3.amazonaws.com/milewski-ctfp-pdf/category-theory-for-programmers.pdf)
# Category Theory For Programmers
<img src="https://user-images.githubusercontent.com/601206/47271389-8eea0900-d581-11e8-8e81-5b932e336336.png"
alt="Buy Category Theory for Programmers" width=410 />
**[Available in full-color hardcover print](https://www.blurb.com/b/9621951-category-theory-for-programmers-new-edition-hardco)**
Publish date: 12 August, 2019. Based off release tag [v1.3.0](https://github.com/hmemcpy/milewski-ctfp-pdf/releases/tag/v1.3.0). See [errata-1.3.0](errata-1.3.0.md) for changes and fixes since print.
An _unofficial_ PDF version of "**C**ategory **T**heory **F**or **P**rogrammers"
by [Bartosz Milewski][bartosz github], converted from his [blogpost
series][blogpost series] (_with permission!_).
**[Scala Edition is now available in paperback](https://www.blurb.com/b/9603882-category-theory-for-programmers-scala-edition-pape)**
Publish date: 12 August, 2019. Based off release tag [v1.3.0](https://github.com/hmemcpy/milewski-ctfp-pdf/releases/tag/v1.3.0). See [errata-scala](errata-scala.md) for changes and fixes since print.
![Category Theory for Programmers][ctfp image]
This is an *unofficial* PDF version of "Category Theory for Programmers" by Bartosz Milewski, converted from his [blogpost series](https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/) (with permission!)
## Buy the book
---
- **[Standard edition in full-color hardcover
print][buy regular edition on blurb]**
- Publish date: 12 August, 2019.
- Based off release tag [v1.3.0][v1.3.0 github release link]. See
[errata-1.3.0](errata-1.3.0.md) for changes and fixes since print.
- **[Scala Edition in paperback][buy scala edition on blurb]**
- Publish date: 12 August, 2019.
- Based off release tag [v1.3.0][v1.3.0 github release link]. See
[errata-scala](errata-scala.md) for changes and fixes since print.
Building
--------
## Build the book
The best way to build the book is using the [Nix](https://nixos.org/nix/) package manager. After [installing Nix](https://nixos.org/download.html), if you're using a non-NixOS operating system, you need to install `nixFlakes` in your environment following the steps below ([source](https://nixos.wiki/wiki/Flakes#Non-NixOS)):
The building workflow requires [Nix][nix website]. After [installing
Nix][nix download website], you need to enable the upcoming "flake" feature
which must be [enabled manually][nixos wiki flake] the time being. This is
needed to expose the new Nix commands and flakes support that are hidden behind
feature-flags.
```bash
$ nix-env -iA nixpkgs.nixFlakes
```
Afterwards, type `nix flake show` in the root directory of the project to see
all the available versions of this book. Then type `nix build .#<edition>` to
build the edition you want (Haskell, Scala, OCaml, Reason and their printed
versions). For example, to build the Scala edition you'll have to type
`nix build .#ctfp-scala`.
Edit either `~/.config/nix/nix.conf` or `/etc/nix/nix.conf` and add:
Upon successful compilation, the PDF file will be placed in the `result`
directory.
```
experimental-features = nix-command flakes
```
The command `nix develop` will provide a shell containing all the required
dependencies to build the book manually using the provided `Makefile`. To build
the `ctfp-scala` edition, just run `make ctfp-scala`.
This is needed to expose the Nix 2.0 CLI and flakes support that are hidden behind feature-flags.
## Contribute
Also, if the Nix installation is in multi-user mode, dont forget to restart the nix-daemon.
Contributors are welcome to contribute to this book by sending pull-requests.
Once reviewed, the changes are merged in the main branch and will be
incorporated in the next release.
Afterwards, type `nix flake show` in the root directory of the project to see all the available versions of this book. Then type `nix build .#<edition>` to build the edition you want (Haskell, Scala, OCaml, Reason and their printed versions). For example, to build the Scala edition you'll have to type `nix build .#ctfp-scala`.
**Note from [Bartosz][bartosz github]**: I really appreciate all your
contributions. You made this book much better than I could have imagined. Thank
you!
Upon successful compilation, the PDF file will be placed in the `result` directory inside the root directory `milewski-ctfp-pdf` of the repository.
Find the [list of contributors on Github][contributors].
The file `preamble.tex` contains all the configuration and style declarations.
## Acknowledgements
Acknowledgements
----------------
PDF LaTeX source and the tools to create it are based on the work by [Andres
Raba][andres raba github]. The book content is taken, with permission, from
[Bartosz Milewski][bartosz github]'s blogpost series, and adapted to the LaTeX
format.
PDF LaTeX source and the tools to create it are based on the work by Andres Raba et al., available here: https://github.com/sarabander/sicp-pdf.
The book content is taken, with permission, from Bartosz Milewski's blogpost series, and adapted to the LaTeX format.
The original blog post acknowledgments by Bartosz are consolidated in the
_Acknowledgments_ page at the end of the book.
Thanks to the following people for contributing corrections/conversions and misc:
## License
* Oleg Rakitskiy
* Jared Weakly
* Paolo G. Giarrusso
* Adi Shavit
* Mico Loretan
* Marcello Seri
* Erwin Maruli Tua Pakpahan
* Markus Hauck
* Yevheniy Zelenskyy
* Ross Kirsling
* ...and many others!
The PDF book, `.tex` files, and associated images and figures in directories
`src/fig` and `src/content` are licensed under [Creative Commons
Attribution-ShareAlike 4.0 International License][license cc by sa].
The original blog post acknowledgments by Bartosz are consolidated in the *Acknowledgments* page at the end of the book.
The script files `scraper.py` and others are licensed under [GNU General Public
License version 3][license gnu gpl].
**Note from Bartosz**: I really appreciate all your contributions. You made this book much better than I could have imagined. Thank you!
License
-------
The PDF book, `.tex` files, and associated images and figures in directories `src/fig` and `src/content` are licensed under Creative Commons Attribution-ShareAlike 4.0 International License ([cc by-sa](http://creativecommons.org/licenses/by-sa/4.0/)).
The script files `scraper.py` and others are licensed under GNU General Public License version 3 (for details, see [LICENSE](https://github.com/hmemcpy/milewski-ctfp-pdf/blob/master/LICENSE)).
[download badge]:
https://img.shields.io/badge/Download-latest-green.svg?style=flat-square
[github actions link]: https://github.com/hmemcpy/milewski-ctfp-pdf/actions
[github stars]:
https://img.shields.io/github/stars/hmemcpy/milewski-ctfp-pdf.svg?style=flat-square
[github workflow status]:
https://img.shields.io/github/actions/workflow/status/hmemcpy/milewski-ctfp-pdf/build.yml?branch=master&style=flat-square
[github latest release]:
https://github.com/hmemcpy/milewski-ctfp-pdf/releases/latest
[license badge]:
https://img.shields.io/badge/License-CC_By_SA-green.svg?style=flat-square
[ctfp image]:
https://user-images.githubusercontent.com/601206/47271389-8eea0900-d581-11e8-8e81-5b932e336336.png
[bartosz github]: https://github.com/BartoszMilewski
[nixos wiki flake]: https://nixos.wiki/wiki/Flakes
[andres raba github]: https://github.com/sarabander
[contributors]: https://github.com/hmemcpy/milewski-ctfp-pdf/graphs/contributors
[license cc by sa]: https://spdx.org/licenses/CC-BY-SA-4.0.html
[license gnu gpl]: https://spdx.org/licenses/GPL-3.0.html
[blogpost series]:
https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/
[buy regular edition on blurb]:
https://www.blurb.com/b/9621951-category-theory-for-programmers-new-edition-hardco
[buy scala edition on blurb]:
https://www.blurb.com/b/9603882-category-theory-for-programmers-scala-edition-pape
[v1.3.0 github release link]:
https://github.com/hmemcpy/milewski-ctfp-pdf/releases/tag/v1.3.0
[nix website]: https://nixos.org/nix/
[nix download website]: https://nixos.org/download.html

View File

@ -1,6 +0,0 @@
let
rev = "cecfd08d13ddef8a79f277e67b8084bd9afa1586";
url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz";
flake = import (fetchTarball url) { src = ./.; };
inNixShell = builtins.getEnv "IN_NIX_SHELL" != "";
in if inNixShell then flake.shellNix else flake.defaultNix

View File

@ -2,82 +2,111 @@
### Preface
* [#155](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/155) - Typo (physicist -> physicists)
- [#155](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/155) - Typo
(physicist -> physicists)
### 6. Simple Algebraic Data Types
* [#176](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/176) - Typo (statements -> statement)
- [#176](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/176) - Typo
(statements -> statement)
### 8. Functoriality
* [9a3a5a3](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/9a3a5a386e98ef8f926bccd08f572cc19b1a6367) - added clarifications on bifunctoriality vs. separate functoriality (fix by Bartosz)
- [9a3a5a3](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/9a3a5a386e98ef8f926bccd08f572cc19b1a6367) -
added clarifications on bifunctoriality vs. separate functoriality (fix by
Bartosz)
### 9. Function Types
* [#182](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/182) - Fix typo (chose -> choose)
- [#182](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/182) - Fix typo
(chose -> choose)
### 10. Natural Transformations
* [#157](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/157) - Adding paragraph indent
- [#157](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/157) - Adding
paragraph indent
### 12. Limits and Colimits
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical error
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
grammatical error
### 14. Representable Functors
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical error
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
grammatical error
### 18. Adjunctions
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling of "counit"
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling
of "counit"
### 19. Free/Forgetful Adjunctions
* [#156](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/156) - an instance of the category name **Mon** is appearing as **arg**
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling of "isomorphism"
- [#156](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/156) - an instance of
the category name **Mon** is appearing as **arg**
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling
of "isomorphism"
### 20. Monads - Programmer's Definition
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix grammatical error
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical error
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix
grammatical error
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
grammatical error
### 22. Monads Categorically
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical error
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
grammatical error
### 23. Comonads
* [#158](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/158) - fixed incorrect typesetting of `set`
* [23f522e](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/23f522ec083c2c98f28f15935ff2893ccd1fa76c) - adjusted `Prod`/`Product` names (fix by Bartosz)
- [#158](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/158) - fixed
incorrect typesetting of `set`
- [23f522e](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/23f522ec083c2c98f28f15935ff2893ccd1fa76c) -
adjusted `Prod`/`Product` names (fix by Bartosz)
### 25. Algebras for Monads
* [#158](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/158) - fixed incorrect typesetting of `set`
* [#159](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/159) - fixed incorrect typesetting of category terms
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling of "counit" and "morphisms", fix subscript spacing
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical errors
- [#158](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/158) - fixed
incorrect typesetting of `set`
- [#159](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/159) - fixed
incorrect typesetting of category terms
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling
of "counit" and "morphisms", fix subscript spacing
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
grammatical errors
### 26. Ends and Coends
* [#159](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/159) - fixed incorrect typesetting of category terms
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling of "coequalizer", fix subscript spacing
- [#159](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/159) - fixed
incorrect typesetting of category terms
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling
of "coequalizer", fix subscript spacing
### 27. Kan Extensions
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix subscript spacing
* [31821e5](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/31821e5ded0dacf059e1fcb985be406e8a495107) - postcomposition -> precomposition (fix by Bartosz)
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix subscript
spacing
- [31821e5](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/31821e5ded0dacf059e1fcb985be406e8a495107) -
postcomposition -> precomposition (fix by Bartosz)
### 28. Enriched Categories
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix subscript spacing
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical error
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix subscript
spacing
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
grammatical error
### 29. Topoi
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical error
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
grammatical error
### 30. Lawvere Theories
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling of "coequalizer"
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical errors and a typesetting error
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling
of "coequalizer"
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
grammatical errors and a typesetting error

View File

@ -1,17 +1,27 @@
## A list of typos/mistakes that were fixed after the release of the new edition (1.3.0) (12 August, 2019).
(see errata for the original edition until 1.3.0 [here](https://github.com/hmemcpy/milewski-ctfp-pdf/blob/master/errata-1.0.0.md))
(see errata for the original edition until 1.3.0
[here](https://github.com/hmemcpy/milewski-ctfp-pdf/blob/master/errata-1.0.0.md))
### Preface
* [#278](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/278) - Fixed reference to Saunders Mac Lane's *Categories for the Working Mathematician*. Was previously misreferenced as "*Category Theory* for the Working Mathematician."
- [#278](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/278) - Fixed
reference to Saunders Mac Lane's _Categories for the Working Mathematician_.
Was previously misreferenced as "_Category Theory_ for the Working
Mathematician."
### 12. Limits and Colimits
* [#278](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/278) - Fixed formatting of quotation marks around "selecting." Were previously pointing the wrong direction.
- [#278](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/278) - Fixed
formatting of quotation marks around "selecting." Were previously pointing the
wrong direction.
### 18. Adjunctions
* [#228](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/228) - Typo (adjuncion -> adjunction)
- [#228](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/228) - Typo
(adjuncion -> adjunction)
### 30. Lawvere Theories
* [#226](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/226) - fix type in diagram of monads as coends
- [#226](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/226) - fix type in
diagram of monads as coends

View File

@ -2,8 +2,12 @@
### 7. Functors
* [3d29cd9](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/3d29cd99f34ce1205ed9a68aeae038d9d47c7145) - Added `LazyList` example, supported since Scala 2.13
- [3d29cd9](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/3d29cd99f34ce1205ed9a68aeae038d9d47c7145) -
Added `LazyList` example, supported since Scala 2.13
* [#210](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/210) - Section 6.4 - `prodToSum` snippet. Explicitly Tupling return type to avoid adapted args warning, which is deprecated behavior
- [#210](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/210) - Section 6.4 -
`prodToSum` snippet. Explicitly Tupling return type to avoid adapted args
warning, which is deprecated behavior
* [#243](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/243) - Section 8.7 - Change bimap to dimap in Profunctor definition
- [#243](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/243) - Section 8.7 -
Change bimap to dimap in Profunctor definition

View File

@ -1,40 +1,60 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1674771137,
"narHash": "sha256-Zpk1GbEsYrqKmuIZkx+f+8pU0qcCYJoSUwNz1Zk+R00=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "7c7a8bce3dffe71203dcd4276504d1cb49dfe05f",
"type": "github"
},
"original": {
"id": "flake-parts",
"type": "indirect"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1645379616,
"narHash": "sha256-eLzR3MRS9hcNqSWZxP6BP7xiBjgC3/pB5n2Q0lLFe/g=",
"lastModified": 1675153841,
"narHash": "sha256-EWvU3DLq+4dbJiukfhS7r6sWZyJikgXn6kNl7eHljW8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "40ef692a55b188b1f5ae3967f3fc7808838c3f1d",
"rev": "ea692c2ad1afd6384e171eabef4f0887d2b882d3",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-21.11",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1672350804,
"narHash": "sha256-jo6zkiCabUBn3ObuKXHGqqORUMH27gYDIFFfLq5P4wg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "677ed08a50931e38382dbef01cba08a8f7eac8f6",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"utils": {
"locked": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs"
}
}
},

196
flake.nix
View File

@ -1,75 +1,124 @@
{
description = "Category Theory for Programmers";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
inputs.utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system: let
outputs = inputs @ {
self,
flake-parts,
nixpkgs,
}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
perSystem = {
config,
pkgs,
system,
...
}: let
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
###########################################################################
# LaTeX font
inconsolata-lgc-latex = pkgs.stdenvNoCC.mkDerivation {
name = "inconsolata-lgc-latex";
pname = "inconsolata-lgc-latex";
src = pkgs.inconsolata-lgc;
dontConfigure = true;
sourceRoot = ".";
installPhase = ''
runHook preInstall
find $src -name '*.ttf' -exec install -m644 -Dt $out/fonts/truetype/public/inconsolata-lgc/ {} \;
find $src -name '*.otf' -exec install -m644 -Dt $out/fonts/opentype/public/inconsolata-lgc/ {} \;
runHook postInstall
'';
tlType = "run";
};
###########################################################################
# LaTeX Environment
texliveEnv = pkgs.texlive.combine {
inherit (pkgs.texlive)
bookcover
textpos
fgruler
tcolorbox
fvextra
framed
newtx
nowidow
emptypage
wrapfig
subfigure
inherit
(pkgs.texlive)
adjustbox
collectbox
tikz-cd
imakeidx
idxlayout
titlesec
subfiles
lettrine
upquote
libertine
mweights
fontaxes
mdframed
needspace
xifthen
ifnextok
currfile
noindentafter
ifmtarg
scheme-medium
listings
minted
microtype
alegreya
babel
todonotes
bookcover
catchfile
chngcntr
ifplatform
xstring
minifp
titlecaps
collectbox
currfile
emptypage
enumitem
environ
trimspaces
l3packages
zref
catchfile
fgruler
fontaxes
framed
fvextra
idxlayout
ifmtarg
ifnextok
ifplatform
imakeidx
import
inconsolata
l3packages
lettrine
libertine
libertinus-fonts
listings
mdframed
microtype
minifp
minted
mweights
needspace
newtx
noindentafter
nowidow
scheme-medium
subfigure
subfiles
textpos
tcolorbox
tikz-cd
titlecaps
titlesec
todonotes
trimspaces
upquote
wrapfig
xifthen
xpatch
xstring
zref
;
inconsolata-lgc-latex = {
pkgs = [inconsolata-lgc-latex];
};
};
###########################################################################
# Python Environment
# Pin the Python version and its associated package set in a single place.
python = pkgs.python38;
pythonPkgs = pkgs.python38Packages;
python = pkgs.python311;
pythonPkgs = pkgs.python311Packages;
pygments-style-github = pythonPkgs.buildPythonPackage rec {
pname = "pygments-style-github";
@ -91,32 +140,34 @@
commonAttrs = {
nativeBuildInputs = [texliveEnv pythonEnv pkgs.which];
FONTCONFIG_FILE = pkgs.makeFontsConf {
fontDirectories = with pkgs; [ inconsolata-lgc libertine libertinus ];
};
};
mkLatex = variant: edition: let
maybeVariant = lib.optionalString (variant != null) "-${variant}";
maybeEdition = lib.optionalString (edition != null) "-${edition}";
variantStr = if variant == null then "reader" else variant;
variantStr =
if variant == null
then "reader"
else variant;
suffix = maybeVariant + maybeEdition;
basename = "ctfp-${variantStr}${maybeEdition}";
version = self.shortRev or self.lastModifiedDate;
in pkgs.stdenv.mkDerivation (commonAttrs // {
in
pkgs.stdenv.mkDerivation (commonAttrs
// {
inherit basename version;
name = "ctfp${suffix}-${version}";
name = "ctfp${suffix}";
fullname = "ctfp${suffix}";
src = "${self}/src";
configurePhase = ''
echo -n "\\newcommand{\\OPTversion}{$version}" > version.tex
substituteInPlace "version.tex" --replace "dev" "${version}"
'';
buildPhase = ''
latexmk -shell-escape -interaction=nonstopmode -halt-on-error \
-norc -jobname=ctfp -pdflatex="xelatex %O %S" -pdf "$basename.tex"
latexmk -file-line-error -shell-escape -logfilewarninglist -interaction=nonstopmode -halt-on-error \
-norc -jobname=ctfp -pdflatex="xelatex %O %S" -pdfxe "$basename.tex"
'';
installPhase = "install -m 0644 -vD ctfp.pdf \"$out/$fullname.pdf\"";
@ -126,24 +177,27 @@
editions = [null "scala" "ocaml" "reason"];
variants = [null "print"];
in {
# nix build .#ctfp
# nix build .#ctfp-print
# nix build .#ctfp-print-ocaml
# etc etc
packages = lib.listToAttrs (lib.concatMap (variant: map (edition: rec {
in rec {
formatter = pkgs.alejandra;
packages = lib.listToAttrs (lib.concatMap (variant:
map (edition: rec {
name = value.packageName;
value = mkLatex variant edition;
}) editions) variants);
# nix build .
defaultPackage = self.packages.${system}.ctfp;
})
editions)
variants);
# nix develop .
devShell = pkgs.mkShell (commonAttrs // {
nativeBuildInputs = commonAttrs.nativeBuildInputs ++ [
pkgs.git pkgs.gnumake
devShells.default = pkgs.mkShellNoCC (commonAttrs
// {
nativeBuildInputs =
commonAttrs.nativeBuildInputs
++ [
pkgs.git
pkgs.gnumake
];
});
});
};
};
}

View File

@ -1,12 +0,0 @@
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{
src = ./.;
}
).shellNix

17
src/.gitignore vendored
View File

@ -1,17 +0,0 @@
*.aux
*.cp*
*.fn
*.ky
*.log
*.pg
*.toc
*.tp
*.vr
*.vim
*.idx
*.ilg
*.ind
*.out
*.swp
*~
ctfp.fdb_latexmk

View File

@ -1,85 +0,0 @@
# Igal Tabachnik, 2007.
# Based on work by Andres Raba et al., 2013-2015.
.PHONY: default all clean out-dir version.tex scala ocaml reason
DIR := $(shell pwd)
GIT_VER := $(shell git describe --tags --always --long | tr -d '\n')
OUTPUT_DIR := ../out
OUTPUT = category-theory-for-programmers
# Default top-level LaTeX to generate
DEFAULTTOPTEX = ctfp-reader.tex ctfp-print.tex
SCALATEXFILES = ctfp-reader-scala.tex ctfp-print-scala.tex # todo make this a macro
OCAMLTEXFILES = ctfp-reader-ocaml.tex ctfp-print-ocaml.tex # todo make this a macro
REASONTEXFILES = ctfp-reader-reason.tex ctfp-print-reason.tex # todo make this a macro
# Top-level LaTeX files from which CTFP book can be generated
TOPTEXFILES = version.tex $(DEFAULTTOPTEX) $(SCALATEXFILES) $(OCAMLTEXFILES) $(REASONTEXFILES)
# Default PDF file to make
DEFAULTPDF:=$(DEFAULTTOPTEX:.tex=.pdf)
# Scala PDF file to make
SCALAPDF:=$(SCALATEXFILES:.tex=.pdf)
# OCaml PDF file to make
OCAMLPDF:=$(OCAMLTEXFILES:.tex=.pdf)
# ReasonML PDF file to make
REASONPDF:=$(REASONTEXFILES:.tex=.pdf)
# Other PDF files for the CTFP book
TOPPDFFILES:=$(TOPTEXFILES:.tex=.pdf)
# Configuration files
OPTFILES = opt-print-ustrade.tex \
opt-reader-10in.tex \
opt-scala.tex
# All the LaTeX files for the CTFP book in order of dependency
TEXFILES = $(TOPTEXFILES) $(SCALATEXFILES) $(OCAMLTEXFILES) $(REASONTEXFILES) $(OPTFILES)
default: suffix=''
default: out-dir $(DEFAULTPDF) # todo cover
all: clean default scala ocaml reason
scala: suffix='-scala'
scala: clean out-dir version.tex $(SCALAPDF)
ocaml: suffix='-ocaml'
ocaml: clean out-dir version.tex $(OCAMLPDF)
reason: suffix='-reason'
reason: clean out-dir version.tex $(REASONPDF)
# Main targets
$(TOPPDFFILES) : %.pdf : %.tex $(TEXFILES)
if which latexmk > /dev/null 2>&1 ;\
then \
latexmk -shell-escape -interaction=nonstopmode -halt-on-error -norc -jobname=ctfp -pdflatex="xelatex %O %S" -pdf $< ;\
mv ctfp.pdf $(OUTPUT_DIR)/$(subst ctfp,$(OUTPUT),$(subst ctfp-reader,$(OUTPUT),$*)).pdf ;\
else @printf "Error: unable to find latexmk. Is it installed?\n" ;\
fi
version.tex:
@printf '\\newcommand{\\OPTversion}{' > version.tex
@printf $(GIT_VER) >> version.tex
@printf '}' >> version.tex
out-dir:
@printf 'Creating output directory: $(OUTPUT_DIR)\n'
mkdir -p $(OUTPUT_DIR)
clean:
rm -f *~ *.aux {ctfp-*}.{out,log,pdf,dvi,fls,fdb_latexmk,aux,brf,bbl,idx,ilg,ind,toc,sed}
if which latexmk > /dev/null 2>&1 ; then latexmk -CA; fi
rm -rf ../out
clean-minted:
rm -rf _minted-*

View File

@ -13,18 +13,7 @@
\usetikzlibrary{calc,positioning, shadings}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\setmainfont[
Path=fonts/,
Extension=.otf,
UprightFont=*-Regular,
ItalicFont=*-Italic,
BoldFont=*-Bold,
UprightFeatures={SmallCapsFont=*SC-Regular},
ItalicFeatures={SmallCapsFont=*SC-Italic},
BoldFeatures={SmallCapsFont=*SC-Bold},
BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
]{AlegreyaSans}
\usepackage{Alegreya}
\newcommand{\olpath}{../}
\newcommand{\whitebg}[1]{%

View File

@ -13,18 +13,7 @@
\usetikzlibrary{calc,positioning, shadings}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\setmainfont[
Path=fonts/,
Extension=.otf,
UprightFont=*-Regular,
ItalicFont=*-Italic,
BoldFont=*-Bold,
UprightFeatures={SmallCapsFont=*SC-Regular},
ItalicFeatures={SmallCapsFont=*SC-Italic},
BoldFeatures={SmallCapsFont=*SC-Bold},
BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
]{AlegreyaSans}
\usepackage{Alegreya}
\newcommand{\olpath}{../}
\newcommand{\whitebg}[1]{%

View File

@ -13,18 +13,7 @@
\usetikzlibrary{calc,positioning, shadings}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\setmainfont[
Path=fonts/,
Extension=.otf,
UprightFont=*-Regular,
ItalicFont=*-Italic,
BoldFont=*-Bold,
UprightFeatures={SmallCapsFont=*SC-Regular},
ItalicFeatures={SmallCapsFont=*SC-Italic},
BoldFeatures={SmallCapsFont=*SC-Bold},
BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
]{AlegreyaSans}
\usepackage{Alegreya}
\newcommand{\olpath}{../}
\newcommand{\whitebg}[1]{%

View File

@ -14,26 +14,7 @@
\usetikzlibrary{calc,positioning, shadings}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
% \setmainfont{AlegreyaSans-Regular}[
% BoldFont={AlegreyaSans-Bold},
% ItalicFont={AlegreyaSans-Italic},
% UprightFeatures={SmallCapsFont=AlegreyaSansSC-Regular},
% ItalicFeatures={SmallCapsFont=AlegreyaSansSC-Italic},
% BoldFeatures={SmallCapsFont=AlegreyaSansSC-Bold},
% BoldItalicFeatures={SmallCapsFont=AlegreyaSansSC-BoldItalic},
% ]
\setmainfont[
Path=fonts/,
Extension=.otf,
UprightFont=*-Regular,
ItalicFont=*-Italic,
BoldFont=*-Bold,
UprightFeatures={SmallCapsFont=*SC-Regular},
ItalicFeatures={SmallCapsFont=*SC-Italic},
BoldFeatures={SmallCapsFont=*SC-Bold},
BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
]{AlegreyaSans}
\usepackage{Alegreya}
\newcommand{\olpath}{../}
\newcommand{\whitebg}[1]{%

View File

@ -14,26 +14,7 @@
\usetikzlibrary{calc,positioning, shadings}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
% \setmainfont{AlegreyaSans-Regular}[
% BoldFont={AlegreyaSans-Bold},
% ItalicFont={AlegreyaSans-Italic},
% UprightFeatures={SmallCapsFont=AlegreyaSansSC-Regular},
% ItalicFeatures={SmallCapsFont=AlegreyaSansSC-Italic},
% BoldFeatures={SmallCapsFont=AlegreyaSansSC-Bold},
% BoldItalicFeatures={SmallCapsFont=AlegreyaSansSC-BoldItalic},
% ]
\setmainfont[
Path=fonts/,
Extension=.otf,
UprightFont=*-Regular,
ItalicFont=*-Italic,
BoldFont=*-Bold,
UprightFeatures={SmallCapsFont=*SC-Regular},
ItalicFeatures={SmallCapsFont=*SC-Italic},
BoldFeatures={SmallCapsFont=*SC-Bold},
BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
]{AlegreyaSans}
\usepackage{Alegreya}
\newcommand{\olpath}{../}
\newcommand{\whitebg}[1]{%

View File

@ -14,18 +14,7 @@
\usetikzlibrary{calc,positioning, shadings}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\setmainfont[
Path=fonts/,
Extension=.otf,
UprightFont=*-Regular,
ItalicFont=*-Italic,
BoldFont=*-Bold,
UprightFeatures={SmallCapsFont=*SC-Regular},
ItalicFeatures={SmallCapsFont=*SC-Italic},
BoldFeatures={SmallCapsFont=*SC-Bold},
BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
]{AlegreyaSans}
\usepackage{Alegreya}
\newcommand{\olpath}{../}
\newcommand{\whitebg}[1]{%

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -23,7 +23,7 @@
\defaultfontfeatures{% % is important for
Scale=MatchLowercase, % needed here ... % single quotes not
} % to turn out curly
\setmonofont[Path=fonts/, BoldFont=Inconsolata-LGC-Bold.ttf]{Inconsolata-LGC-Bold.ttf} % ("typographic")
\setmonofont[BoldFont=Inconsolata-LGC-Bold.ttf]{Inconsolata-LGC-Bold.ttf} % ("typographic")
% in verbatim blocks
\defaultfontfeatures{% % of Haskell code.
Scale=MatchLowercase, % ... and here again % Now the quote is
@ -43,7 +43,7 @@
\expandafter\let\csname not<\endcsname\relax
\expandafter\let\csname not>\endcsname\relax
\usepackage{unicode-math}
\setmathfont[Path=fonts/]{LibertinusMath-Regular.otf}
\setmathfont{LibertinusMath-Regular.otf}
\usepackage[all]{nowidow}
\usepackage{emptypage}
@ -170,6 +170,16 @@
{\end{Verbatim}\end{mdframed}
\vspace{-1ex}}
% See the context about this workaround at
% https://github.com/gpoore/minted/issues/354
\makeatletter
\ifwindows
\def\minted@opt@quote#1{\detokenize\expandafter{\expandafter"\expanded{#1}"}}
\else
\def\minted@opt@quote#1{\detokenize\expandafter{\expandafter'\expanded{#1}'}}
\fi
\makeatother
\NewDocumentCommand\src{mO{}}{
\srcsnippet{\currfileabsdir/code/haskell/#1.hs}{blue}{haskell}{#2}
\ifdefined\OPTCustomLanguage{%

1
src/version.tex Normal file
View File

@ -0,0 +1 @@
\newcommand\OPTversion{dev}