commit dd3a223a1ce88c25007b22a4c7134eec6601080d Author: Sebastian Rust Date: Wed Mar 8 14:01:45 2023 +0100 Initial commit diff --git a/.cookiecutter.json b/.cookiecutter.json new file mode 100644 index 0000000..ac70c87 --- /dev/null +++ b/.cookiecutter.json @@ -0,0 +1,20 @@ +{ + "_copy_without_render": [ + "lib/*", + "fig/*", + "*.sty", + "*.lua" + ], + "_output_dir": "/home/jack/Work/paper", + "_template": "https://github.com/aroig/cookiecutter-latex-paper", + "date": "2023-03-08", + "email": "harlequix@gmail.com", + "full_name": "Sebastian Rust", + "funding": "None", + "language": "english", + "project_name": "quic-message", + "project_slug": "quic-message", + "project_type": "paper", + "title": "The Title", + "url": "https://kom.tu-darmstadt.de" +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..928f8b8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +*~ +.\#* +.auto +build/* +bib/* +*.gz +*.zip +*.ps +*.pdf +*.dvi +*.png +*.jpg +*.eps diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7dfc4d0 --- /dev/null +++ b/Makefile @@ -0,0 +1,360 @@ +# Copyright (c) 2023, Sebastian Rust +# All rights reserved. +# +# This file is part of 'quic-message'. + + +#----------------------------------# +# Variables # +#----------------------------------# + +# Tools +LATEX := latex +LUALATEX := lualatex +BIBTEX := biber + +# Latexdiff config +LATEXDIFF_IGNORE := picture tikzpicture tikzcd DIFnomarkup +LATEXDIFF_PACKAGES := amsmath hyperref + +# Execution flags +LATEX_FLAGS := --shell-escape --halt-on-error --interaction=nonstopmode +LATEXDIFF_FLAGS := --packages=$(subst ' ',',',$(LATEXDIFF_PACKAGES)) \ + --config "PICTUREENV=(?:$(subst ' ',|,$(LATEXDIFF_IGNORE)))[\w\d*@]*" + +#----------------------------------# +# Directories # +#----------------------------------# + +BLDDIR := ./build +FIGDIR := ./fig +LIBDIR := ./lib +REFDIR := ./ref +FLATDIR := ./build/flat +DIFFDIR := ./build/diff + + +#----------------------------------# +# Source Files # +#----------------------------------# + +METADATA := metadata.bib +DOCID := $(shell perl -ne '/\@article[a-zA-Z{]*:(.*),/ && print "$$1\n"' $(METADATA)) +DOCTYPE := $(shell perl -ne '/entrysubtype\s*=\s*{\s*(.*)\s*}/ && print "$$1\n"' $(METADATA)) + +MKPREAMBLE := make/mkpreamble.py +PREAMBLE := preamble.tex +GITREF := gitref + +FIGFILES := $(sort $(wildcard $(FIGDIR)/*.png) $(wildcard $(FIGDIR)/*.pdf)) +LIBFILES := $(sort $(wildcard *.sty) $(wildcard $(LIBDIR)/*)) +BIBFILES := $(sort $(filter-out $(METADATA),$(wildcard *.bib))) +TEXFILES := $(sort $(wildcard *.tex) $(PREAMBLE)) +AUXFILES := $(patsubst %.tex,$(notdir %.aux),$(TEXFILES)) +TOCFILES := $(DOCID).toc + +BLDFILES := Makefile .gitignore README.md $(METADATA) $(MKPREAMBLE) +BLDFILES := $(foreach f,$(BLDFILES),$(wildcard $(f))) + + +#----------------------------------# +# Configurable variables # +#----------------------------------# + +## Git reference to compute diff against +REF := HEAD + + +#----------------------------------# +# Functions # +#----------------------------------# + +# setup environment for some commands +latex-environment = TEXINPUTS="$1:$(LIBDIR):$(FIGDIR):" LUAINPUTS="$1:$(LIBDIR):" +lua-environment = LUA_PATH="$(LIBDIR)/?.lua" + +# extract tex file dependencies +latex-dependencies = $1.tex $(foreach p,\ + $(shell perl -ne '/^\s*\\(input|include)\{(.*?)(.tex)?\}/ && print "$$2.tex "' $1.tex),\ + $(dir $1)$(p)\ +) + +# bibliography files +doc-pdf-dependencies = $(call latex-dependencies,$1) \ + $(if $(BIBFILES),$(BLDDIR)/$1.bbl) \ + $(PREAMBLE) $(LIBFILES) $(FIGFILES) + +doc-src-dependencies = $(call doc-pdf-dependencies,$1) + +doc-html-dependencies = $(call latex-dependencies,$1) \ + $(if $(BIBFILES),$(BLDDIR)/html/$1.bbl) \ + $(PREAMBLE) $(LIBFILES) $(FIGFILES) + +# write string $2 to file $1 only if it is different from its contents. +write-if-changed-cmd = if [ ! -f "$2" ] || [ ! "$1" = "`cat $2 2> /dev/null`" ]; then echo "$1" > "$2"; fi + + +#----------------------------------# +# Abstract rules # +#----------------------------------# + +# shell settings +SHELL := /usr/bin/bash +.SHELLFLAGS := -e -u -c + +# Use a single shell +.ONESHELL: + +# So we can use $$(variable) on the prerequisites, that expand at matching time +.SECONDEXPANSION: + +# never handle as intermediate targets but never delete them +.SECONDARY: + +# always trigger rebuilds on those +.PHONY: pdf epub 2in1 src flat flatsrc diff figs clean + +all: pdf + +## Build PDF +pdf: $(DOCID).pdf $(DOCID).synctex.gz + +## Build epub +epub: $(DOCID).epub + +## Build PDF 2-in-1 +2in1: $(DOCID).2in1.pdf + +## Build source packages +src: $(DOCID).tar.gz + +## Build flattened PDF +flat: $(FLATDIR)/$(DOCID).pdf + +## Build flattened sources +flatsrc: $(FLATDIR)/$(DOCID).tar.gz + +## Build PDF with differences highlighted +diff: $(DIFFDIR)/$(DOCID).pdf + +## Produce figures +figs: $(FIGFILES) + +## Remove build files +clean: + rm -Rf $(BLDDIR) $(FLATDIR) $(DIFFDIR) + rm -Rf *.pdf *.tar.gz *.synctex.gz + + +#----------------------------------# +# Generic file rules # +#----------------------------------# + +# add dependency to force always rebuild but still checking the file timestamps. +FORCE: + +# create file with a hash, used to track modifications to the original file +$(BLDDIR)/%.sha: $(BLDDIR)/% + @mkdir -p $(dir $@) + SHA="`sha256sum '$<'`"; $(call write-if-changed-cmd,$$SHA,$@) + +# convert pdf to ps +$(BLDDIR)/%.ps: $(BLDDIR)/%.pdf + pdftops -paper A4 $< $@ + +# make a 2in1 ps +$(BLDDIR)/%.ps.imposed: $(BLDDIR)/%.ps + cd $(dir $<); impose $(notdir $<) + +# make a 2in1 pdf +%.2in1.pdf: $(BLDDIR)/%.ps.imposed + ps2pdf -sPAPERSIZE=a4 $< $@ + +# copy files from the build directory +%.pdf: $(BLDDIR)/%.pdf + cp $< $@ + +%.epub: $(BLDDIR)/%.epub + cp $< $@ + +%.synctex.gz: $(BLDDIR)/%.pdf + cp "$(BLDDIR)/$*.synctex.gz" "$@" + +%.tar.gz: $(BLDDIR)/%.tar.gz + cp $< $@ + + +#----------------------------------# +# Git rules # +#----------------------------------# + +$(BLDDIR)/$(GITREF): FORCE + @mkdir -p $(dir $@) + $(call write-if-changed-cmd,$(shell git describe --always --tags --dirty=+),$@) + +$(DIFFDIR)/$(GITREF): FORCE + @mkdir -p $(dir $@) + $(call write-if-changed-cmd,$(shell git describe --always --tags $(REF)),$@) + +$(DIFFDIR)/old/%.tex: $(DIFFDIR)/$(GITREF) + @mkdir -p $(dir $@) + git show $(shell cat $<):$*.tex > $@ + + +#----------------------------------# +# Preamble and bibliography # +#----------------------------------# + +# create a preamble tex file +$(PREAMBLE): $(MKPREAMBLE) $(METADATA) + @python $^ > $@ + +# precompile headers +$(BLDDIR)/preamble.fmt: $(PREAMBLE) + @mkdir -p $(dir $@) + $(call latex-environment,$(dir $<)) $(LUALATEX) $(LATEX_FLAGS) -ini \ + -job-name="preamble" "&lualatex $<\dump" --output-directory=$(dir $@) $< + +# compile document to produce the bcf file. we do not want to rebuild on every tex file change. +$(BLDDIR)/%.bcf: | $$(call latex-dependencies,%) + @mkdir -p $(dir $@) + $(call latex-environment,$(dir $<)) $(LUALATEX) $(LATEX_FLAGS) \ + --output-directory=$(dir $@) $*.tex + +# prepare bibliography when bibliography file changes. Do not rebuild when bcf file changes. +$(BLDDIR)/%.bbl: $(BIBFILES) | $(BLDDIR)/%.bcf + @mkdir -p $(dir $@) + $(BIBTEX) --input-directory=$(dir $@) --output-directory=$(dir $@) $*.bcf + + +#----------------------------------# +# pdf document # +#----------------------------------# + +# compile pdf with up to date bibliography +$(BLDDIR)/%.pdf: %.tex $$(call doc-pdf-dependencies,%) | $(BLDDIR)/$(GITREF) + @mkdir -p $(dir $@) + $(call latex-environment,$(dir $<)) $(LUALATEX) $(LATEX_FLAGS) \ + --synctex=1 --output-directory=$(dir $@) $< + +# compile one chapter alone +$(BLDDIR)/chapter-%.pdf: chapter-%.tex $(PREAMBLE) $(FIGFILES) | $(BLDDIR)/$(GITREF) + @mkdir -p $(dir $@) + $(call latex-environment,$(dir $<)) $(LUALATEX) $(LATEX_FLAGS) \ + --synctex=1 --output-directory=$(dir $@) \ + -jobname=chapter-$* "\\includeonly{$<}\\input{$(DOCID).tex}" + +# make a tar.gz package of the sources +$(BLDDIR)/%.tar.gz: %.tex $$(call doc-src-dependencies) $(BIBFILES) $(BLDFILES) + @mkdir -p $(dir $@) + tar -cz -f $@ $(patsubst ./%,%,$^) + +# make a tikz figure +$(FIGDIR)/%.pdf: $(FIGDIR)/%.tex + @( cd $(FIGDIR); $(LUALATEX) --jobname=$* --output-directory=$(BLDDIR) $(notdir $<) ) + cp $(BLDDIR)/$*.pdf $@ + + +#----------------------------------# +# epub document # +#----------------------------------# + +$(BLDDIR)/html/%.bbl: $(BLDDIR)/%.bbl + @mkdir -p $(dir $@) + cp $< $@ + +# This obscure code comes from /usr/bin/htlatex +$(BLDDIR)/html/%.dvi: %.tex $$(call doc-html-dependencies,%) | $(BLDDIR)/$(GITREF) + @mkdir -p $(dir $@) + $(call latex-environment,$(dir $<)) $(LATEX) $(LATEX_FLAGS) --output-directory=$(dir $@) '\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode html.a.b.c.\input ' $< + +$(BLDDIR)/html/%.html: $(BLDDIR)/html/%.dvi + @mkdir -p $(dir $@) + ( + cd $(dir $@) + tex4ht -f/$(notdir $<) # -i~/tex4ht.dir/texmf/tex4ht/ht-fonts/$3 + t4ht -f/$(notdir $<) + ) + +$(BLDDIR)/%.epub: $(BLDDIR)/html/%.html + @mkdir -p $(dir $@) + ebook-convert $< $@ --no-default-epub-cover + + +#----------------------------------# +# Make diff and flat # +#----------------------------------# + +# flatten sources +$(FLATDIR)/%.tex: %.tex + @mkdir -p $(dir $@) + latexpand -o $@ $< + +$(DIFFDIR)/%.tex: $(DIFFDIR)/old/%.tex %.tex + @mkdir -p $(dir $@) + latexdiff $(LATEXDIFF_FLAGS) $^ > $@ + + +#----------------------------------# +# Miscelania rules # +#----------------------------------# + +.PHONY: ref-tree auto-bib + +## Prepare a tree of symlinks to the bibliography +ref-tree: + rm -Rf $(REFDIR) + cali lktree --classifier=flat "tag:paper:$(DOCID)" $(REFDIR) + +## Autogenerate bibliography from citation keys +auto-bib: + cali find --fmt=bib "tag:paper:$(DOCID)" > $(DOCID).auto.bib + + +.PHONY: view-pdf view-epub view slideshow + +## Open PDF document +view-pdf: $(DOCID).pdf + xdg-open $< & + +## Open epub document +view-epub: $(DOCID).epub + xdg-open $< & + +## Open PDF document +view: view-pdf + +## Start a slideshow +slideshow: $(DOCID).pdf + pdfpc $< & + + +# ---------------------------------# +# Source maintenance # +# ---------------------------------# + +.PHONY: update-template update-copyright + +## Update cookiecutter template branch +update-template: + @python make/cookiecutter-update.py ".cookiecutter.json" template + +## Update copyright from file headers +update-copyright: + @year=$$(date '+%Y') + git ls-files | while read f; do + sed -i "1,10{s/Copyright (c) \([0-9]\+\)\(-[0-9]\+\)\?,/Copyright (c) \1-$$year,/}" "$$f" + sed -i "1,10{s/Copyright (c) $$year-$$year,/Copyright (c) $$year,/}" "$$f" + done + + +.PHONY: help + +## Print Makefile documentation +help: + @perl -0 -nle 'printf("%-25s - %s\n", "$$2", "$$1") while m/^##\s*([^\r\n]+)\n^([\w-]+):[^=]/gm' \ + $(MAKEFILE_LIST) | sort + printf "\n" + perl -0 -nle 'printf("%-25s - %s\n", "$$2=", "$$1") while m/^##\s*([^\r\n]+)\n^([\w-]+)\s*:=/gm' \ + $(MAKEFILE_LIST) | sort + diff --git a/README.md b/README.md new file mode 100644 index 0000000..1ec7104 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +README +====== + +## How to compile +To produce a pdf file: + + make pdf + +To produce a source distribution tarball: + + make src + +To open the PDF output in a viewer + + make view + +To rebuild everything, from scratch, bibliography pass, etc + + make -B pdf + +To get a list of avaliable make targets + + make help + + +## Dependencies +* Standard linux environment with GNU make, perl, python and bash + +* lualatex: distributed with texlive since 2010. http://www.tug.org/texlive/ + +* biber: to generate bibliographies. http://biblatex-biber.sourceforge.net/ + + +Optional dependencies: + +* pgf/tikz: For graphics and commutative diagrams. + http://pgf.sourceforge.net/ + +* impose+: To produce 2-in-1 pdf's. + +* git: For versioning the code. + http://git-scm.com/ + +* latexdiff: Used for producing highlighted diff pdfs when under git. latexdiff + is distributed with texlive, for instance. + + diff --git a/fig/.gitignore b/fig/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/lib/abdoalias.sty b/lib/abdoalias.sty new file mode 100644 index 0000000..cd42507 --- /dev/null +++ b/lib/abdoalias.sty @@ -0,0 +1,671 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{abdoalias} + +%% Package Loading +%% ==================================================== + +\RequirePackage{iftex} % do conditionals on tex engine +\RequirePackage{suffix} % define starred commands + +\RequirePackage{amsmath} % AMS stuff +\RequirePackage{amsfonts} % AMS fonts +\RequirePackage{amssymb} % AMS symbols + +\RequirePackage{slashed} % Feynman slashes. + +% \RequirePackage{tensor} % Typeset tensor indices. +% \RequirePackage{young} % Draw Young tableaux. +\RequirePackage{stmaryrd} % Extra math symbols (like double square bracket) + + +%% Font change shortcuts +%% ==================================================== + +% Shortcuts to blackboard bold. +%----------------------------- +\newcommand*{\bbA}{\mathbb{A}} +\newcommand*{\bbB}{\mathbb{B}} +\newcommand*{\bbC}{\mathbb{C}} +\newcommand*{\bbD}{\mathbb{D}} +\newcommand*{\bbE}{\mathbb{E}} +\newcommand*{\bbF}{\mathbb{F}} +\newcommand*{\bbG}{\mathbb{G}} +\newcommand*{\bbH}{\mathbb{H}} +\newcommand*{\bbI}{\mathbb{I}} +\newcommand*{\bbJ}{\mathbb{J}} +\newcommand*{\bbK}{\mathbb{K}} +\newcommand*{\bbL}{\mathbb{L}} +\newcommand*{\bbM}{\mathbb{M}} +\newcommand*{\bbN}{\mathbb{N}} +\newcommand*{\bbO}{\mathbb{O}} +\newcommand*{\bbP}{\mathbb{P}} +\newcommand*{\bbQ}{\mathbb{Q}} +\newcommand*{\bbR}{\mathbb{R}} +\newcommand*{\bbS}{\mathbb{S}} +\newcommand*{\bbT}{\mathbb{T}} +\newcommand*{\bbU}{\mathbb{U}} +\newcommand*{\bbV}{\mathbb{V}} +\newcommand*{\bbW}{\mathbb{W}} +\newcommand*{\bbX}{\mathbb{X}} +\newcommand*{\bbY}{\mathbb{Y}} +\newcommand*{\bbZ}{\mathbb{Z}} + + +% Shortcuts to script fonts +%----------------------------- +\newcommand*{\scA}{\mathscr{A}} +\newcommand*{\scB}{\mathscr{B}} +\newcommand*{\scC}{\mathscr{C}} +\newcommand*{\scD}{\mathscr{D}} +\newcommand*{\scE}{\mathscr{E}} +\newcommand*{\scF}{\mathscr{F}} +\newcommand*{\scG}{\mathscr{G}} +\newcommand*{\scH}{\mathscr{H}} +\newcommand*{\scI}{\mathscr{I}} +\newcommand*{\scJ}{\mathscr{J}} +\newcommand*{\scK}{\mathscr{K}} +\newcommand*{\scL}{\mathscr{L}} +\newcommand*{\scM}{\mathscr{M}} +\newcommand*{\scN}{\mathscr{N}} +\newcommand*{\scO}{\mathscr{O}} +\newcommand*{\scP}{\mathscr{P}} +\newcommand*{\scQ}{\mathscr{Q}} +\newcommand*{\scR}{\mathscr{R}} +\newcommand*{\scS}{\mathscr{S}} +\newcommand*{\scT}{\mathscr{T}} +\newcommand*{\scU}{\mathscr{U}} +\newcommand*{\scV}{\mathscr{V}} +\newcommand*{\scW}{\mathscr{W}} +\newcommand*{\scX}{\mathscr{X}} +\newcommand*{\scY}{\mathscr{Y}} +\newcommand*{\scZ}{\mathscr{Z}} + + +% Shortcuts to caligraphic +%----------------------------- +\newcommand*{\caA}{\mathcal{A}} +\newcommand*{\caB}{\mathcal{B}} +\newcommand*{\caC}{\mathcal{C}} +\newcommand*{\caD}{\mathcal{D}} +\newcommand*{\caE}{\mathcal{E}} +\newcommand*{\caF}{\mathcal{F}} +\newcommand*{\caG}{\mathcal{G}} +\newcommand*{\caH}{\mathcal{H}} +\newcommand*{\caI}{\mathcal{I}} +\newcommand*{\caJ}{\mathcal{J}} +\newcommand*{\caK}{\mathcal{K}} +\newcommand*{\caL}{\mathcal{L}} +\newcommand*{\caM}{\mathcal{M}} +\newcommand*{\caN}{\mathcal{N}} +\newcommand*{\caO}{\mathcal{O}} +\newcommand*{\caP}{\mathcal{P}} +\newcommand*{\caQ}{\mathcal{Q}} +\newcommand*{\caR}{\mathcal{R}} +\newcommand*{\caS}{\mathcal{S}} +\newcommand*{\caT}{\mathcal{T}} +\newcommand*{\caU}{\mathcal{U}} +\newcommand*{\caV}{\mathcal{V}} +\newcommand*{\caW}{\mathcal{W}} +\newcommand*{\caX}{\mathcal{X}} +\newcommand*{\caY}{\mathcal{Y}} +\newcommand*{\caZ}{\mathcal{Z}} + + +% Shortcuts to bold fonts +%----------------------------- +\newcommand*{\bfA}{\mathbf{A}} +\newcommand*{\bfB}{\mathbf{B}} +\newcommand*{\bfC}{\mathbf{C}} +\newcommand*{\bfD}{\mathbf{D}} +\newcommand*{\bfE}{\mathbf{E}} +\newcommand*{\bfF}{\mathbf{F}} +\newcommand*{\bfG}{\mathbf{G}} +\newcommand*{\bfH}{\mathbf{H}} +\newcommand*{\bfI}{\mathbf{I}} +\newcommand*{\bfJ}{\mathbf{J}} +\newcommand*{\bfK}{\mathbf{K}} +\newcommand*{\bfL}{\mathbf{L}} +\newcommand*{\bfM}{\mathbf{M}} +\newcommand*{\bfN}{\mathbf{N}} +\newcommand*{\bfO}{\mathbf{O}} +\newcommand*{\bfP}{\mathbf{P}} +\newcommand*{\bfQ}{\mathbf{Q}} +\newcommand*{\bfR}{\mathbf{R}} +\newcommand*{\bfS}{\mathbf{S}} +\newcommand*{\bfT}{\mathbf{T}} +\newcommand*{\bfU}{\mathbf{U}} +\newcommand*{\bfV}{\mathbf{V}} +\newcommand*{\bfW}{\mathbf{W}} +\newcommand*{\bfX}{\mathbf{X}} +\newcommand*{\bfY}{\mathbf{Y}} +\newcommand*{\bfZ}{\mathbf{Z}} + + +% Shortcuts to Roman fonts +%----------------------------- +\newcommand*{\rmA}{\mathrm{A}} +\newcommand*{\rmB}{\mathrm{B}} +\newcommand*{\rmC}{\mathrm{C}} +\newcommand*{\rmD}{\mathrm{D}} +\newcommand*{\rmE}{\mathrm{E}} +\newcommand*{\rmF}{\mathrm{F}} +\newcommand*{\rmG}{\mathrm{G}} +\newcommand*{\rmH}{\mathrm{H}} +\newcommand*{\rmI}{\mathrm{I}} +\newcommand*{\rmJ}{\mathrm{J}} +\newcommand*{\rmK}{\mathrm{K}} +\newcommand*{\rmL}{\mathrm{L}} +\newcommand*{\rmM}{\mathrm{M}} +\newcommand*{\rmN}{\mathrm{N}} +\newcommand*{\rmO}{\mathrm{O}} +\newcommand*{\rmP}{\mathrm{P}} +\newcommand*{\rmQ}{\mathrm{Q}} +\newcommand*{\rmR}{\mathrm{R}} +\newcommand*{\rmS}{\mathrm{S}} +\newcommand*{\rmT}{\mathrm{T}} +\newcommand*{\rmU}{\mathrm{U}} +\newcommand*{\rmV}{\mathrm{V}} +\newcommand*{\rmW}{\mathrm{W}} +\newcommand*{\rmX}{\mathrm{X}} +\newcommand*{\rmY}{\mathrm{Y}} +\newcommand*{\rmZ}{\mathrm{Z}} + + +% Shortcuts Fraktur +%----------------------------- +\newcommand*{\fka}{\mathfrak{a}} +\newcommand*{\fkb}{\mathfrak{b}} +\newcommand*{\fkc}{\mathfrak{c}} +\newcommand*{\fkd}{\mathfrak{d}} +\newcommand*{\fke}{\mathfrak{e}} +\newcommand*{\fkf}{\mathfrak{f}} +\newcommand*{\fkg}{\mathfrak{g}} +\newcommand*{\fkh}{\mathfrak{h}} +\newcommand*{\fki}{\mathfrak{i}} +\newcommand*{\fkj}{\mathfrak{j}} +\newcommand*{\fkk}{\mathfrak{k}} +\newcommand*{\fkl}{\mathfrak{l}} +\newcommand*{\fkm}{\mathfrak{m}} +\newcommand*{\fkn}{\mathfrak{n}} +\newcommand*{\fko}{\mathfrak{o}} +\newcommand*{\fkp}{\mathfrak{p}} +\newcommand*{\fkq}{\mathfrak{q}} +\newcommand*{\fkr}{\mathfrak{r}} +\newcommand*{\fks}{\mathfrak{s}} +\newcommand*{\fkt}{\mathfrak{t}} +\newcommand*{\fku}{\mathfrak{u}} +\newcommand*{\fkv}{\mathfrak{v}} +\newcommand*{\fkw}{\mathfrak{w}} +\newcommand*{\fkx}{\mathfrak{x}} +\newcommand*{\fky}{\mathfrak{y}} +\newcommand*{\fkz}{\mathfrak{z}} + +\newcommand*{\fkA}{\mathfrak{A}} +\newcommand*{\fkB}{\mathfrak{B}} +\newcommand*{\fkC}{\mathfrak{C}} +\newcommand*{\fkD}{\mathfrak{D}} +\newcommand*{\fkE}{\mathfrak{E}} +\newcommand*{\fkF}{\mathfrak{F}} +\newcommand*{\fkG}{\mathfrak{G}} +\newcommand*{\fkH}{\mathfrak{H}} +\newcommand*{\fkI}{\mathfrak{I}} +\newcommand*{\fkJ}{\mathfrak{J}} +\newcommand*{\fkK}{\mathfrak{K}} +\newcommand*{\fkL}{\mathfrak{L}} +\newcommand*{\fkM}{\mathfrak{M}} +\newcommand*{\fkN}{\mathfrak{N}} +\newcommand*{\fkO}{\mathfrak{O}} +\newcommand*{\fkP}{\mathfrak{P}} +\newcommand*{\fkQ}{\mathfrak{Q}} +\newcommand*{\fkR}{\mathfrak{R}} +\newcommand*{\fkS}{\mathfrak{S}} +\newcommand*{\fkT}{\mathfrak{T}} +\newcommand*{\fkU}{\mathfrak{U}} +\newcommand*{\fkV}{\mathfrak{V}} +\newcommand*{\fkW}{\mathfrak{W}} +\newcommand*{\fkX}{\mathfrak{X}} +\newcommand*{\fkY}{\mathfrak{Y}} +\newcommand*{\fkZ}{\mathfrak{Z}} + + +% Shortcuts for font types in math mode. +%----------------------------- +\newcommand*{\mbb}[1]{\mathbb{#1}} % Blackboard Bold +\newcommand*{\msf}[1]{\mathsf{#1}} % Serif +\newcommand*{\mbf}[1]{\mathbf{#1}} % Bold +\newcommand*{\mrm}[1]{\mathrm{#1}} % Roman +\newcommand*{\mfk}[1]{\mathfrak{#1}} % Fraktur +\newcommand*{\msc}[1]{\mathscr{#1}} % Script +\newcommand*{\mca}[1]{\mathcal{#1}} % Calligraphic + + +%% Symbol shortcuts +%% ==================================================== + +% Shortcuts for arrows +%----------------------------- +\newcommand*{\into}{\hookrightarrow} +\newcommand*{\onto}{\twoheadrightarrow} +\newcommand*{\cof}{\rightarrowtail} +\newcommand*{\fib}{\twoheadrightarrow} +\newcommand*{\acof}{\stackrel{\sim}{\rightarrowtail}} +\newcommand*{\afib}{\stackrel{\sim}{\twoheadrightarrow}} +\newcommand*{\weq}{\stackrel{\sim}{\to}} +\newcommand*{\iso}{\stackrel{\simeq}{\to}} +%\newcommand*{\rto}{\mathop{\dashrightarrow\!\!\!\!\!% +% {\color{white}\blacktriangleright}% +% \!\!\!\!\!\!\rightarrow}} +\newcommand*{\dashto}{\dashrightarrow} + + +% Brackets +%----------------------------- +\newcommand{\abs}[1]{\left \lvert #1 \right \rvert} +\newcommand{\set}[1]{\left \lbrace #1\right \rbrace} +\newcommand{\nrm}[1]{\left \lVert #1 \right \rVert} +\newcommand{\abk}[1]{\left \langle #1 \right \rangle} +\newcommand{\rbk}[1]{\left ( #1 \right )} +\newcommand{\cbk}[1]{\left \lbrace #1 \right \rbrace} +\newcommand{\sbk}[1]{\left \lbrack #1 \right \rbrack} +\newcommand{\dsbk}[1]{\left \llbracket #1 \right \rrbracket} + +\newcommand{\bra}[1]{\langle #1 \rvert} +\newcommand{\ket}[1]{\lvert #1 \rangle} +\newcommand{\qmbk}[2]{\langle #1 \mid #2 \rangle} + + +% Operators +%----------------------------- +\newcommand*{\tsr}{\otimes} +\newcommand*{\btsr}{\boxtimes} +\newcommand*{\bigtsr}{\bigotimes} +\newcommand*{\tms}{\times} +\newcommand*{\rtm}{\rtimes} +\newcommand*{\ltm}{\ltimes} +\newcommand*{\cuppr}{\smallsmile} +\newcommand*{\cappr}{\smallfrown} + + +% Modifiers +%----------------------------- +\newcommand*{\sla}[1]{\slashed{#1}} +\newcommand*{\ol}[1]{\overline{#1}} +\newcommand*{\wh}[1]{\widehat{#1}} +\newcommand*{\wt}[1]{\widetilde{#1}} + + +% Symbols +%----------------------------- +\newcommand*{\id}{\mathrm{id}} +\newcommand*{\es}{\varnothing} +\newcommand*{\sm}{\smallsetminus} +\newcommand*{\sub}{\subset} +\newcommand*{\subeq}{\subseteq} +\newcommand*{\ieq}{\cong} +\newcommand*{\deq}{\stackrel{\mathrm{def}}{=}} +\newcommand*{\heq}{\simeq} +\newcommand*{\dg}{\dagger} +\newcommand*{\bt}{\bullet} +\newcommand*{\trans}{\pitchfork} + +\newcommand*{\oo}{\infty} +\newcommand*{\cl}{\colon} +\newcommand*{\hy}{\text{-}} +\newcommand*{\cm}{\circ} + +\let\amp\& + + +% Operators +%----------------------------- +\newcommand*{\sq}{\square} +\newcommand*{\sqb}{\overline{\square}} + +\newcommand*{\nbl}{\nabla} +\newcommand*{\nblb}{\overline{\nabla}} +\newcommand*{\nbls}{\slashed{\nabla}} + +\newcommand*{\del}{\partial} +\newcommand*{\delb}{\overline{\partial}} +\newcommand*{\dels}{\slashed{\partial}} + +\newcommand*{\df}{\mathrm{d}} + + +% Unicode symbols +%----------------------------- +\ifLuaTeX + \newcommand{\acts}{\ensuremath{\,\rotatebox[origin=c]{-90}{$↻$}\,}} +\else + \newcommand{\acts}{% + \ensuremath{\,\rotatebox[origin=c]{-90}{$\raisebox{0.3mm}{\circlearrowright}$}\,} + } +\fi + + + +%% Subject specific symbols +%% ==================================================== + + +% Limits and colimits +%----------------------------- +\DeclareMathOperator{\hocofib}{\mathrm{hocofib}} +\DeclareMathOperator{\hofib}{\mathrm{hofib}} +\DeclareMathOperator*{\hocolim}{\mathrm{hocolim}} +\DeclareMathOperator*{\holim}{\mathrm{holim}} +\DeclareMathOperator*{\colim}{\mathrm{colim}} +\DeclareMathOperator{\image}{\mathrm{Im}} +\DeclareMathOperator{\coker}{\mathrm{coker}} + +\newcommand*{\plim}{\varprojlim} +\newcommand*{\ilim}{\varinjlim} + + +% Hom-sets +%----------------------------- +\DeclareMathOperator{\Aut}{\mathrm{Aut}} +\DeclareMathOperator{\cAut}{\mathcal{A}\mathit{ut}} +\DeclareMathOperator{\sAut}{\mathscr{A}\negthinspace\mathit{ut}} +\DeclareMathOperator{\bAut}{\mathbf{Aut}} +\DeclareMathOperator{\uAut}{\underline{\mathrm{Aut}}} + +\DeclareMathOperator{\Iso}{\mathrm{Iso}} +\DeclareMathOperator{\cIso}{\mathcal{I}\negthinspace\mathit{so}} +\DeclareMathOperator{\sIso}{\mathscr{I}\negthickspace\mathit{so}} +\DeclareMathOperator{\bIso}{\mathbf{Iso}} +\DeclareMathOperator{\uIso}{\underline{\mathrm{Iso}}} + +\DeclareMathOperator{\Hom}{\mathrm{Hom}} +\DeclareMathOperator{\cHom}{\mathcal{H}\negthinspace\mathit{om}} +\DeclareMathOperator{\sHom}{\mathscr{H}\negthickspace\mathit{om}} +\DeclareMathOperator{\bHom}{\mathbf{Hom}} +\DeclareMathOperator{\uHom}{\underline{\mathrm{Hom}}} + +\DeclareMathOperator{\Map}{\mathrm{Map}} +\DeclareMathOperator{\cMap}{\mathcal{M}\mathit{ap}} +\DeclareMathOperator{\sMap}{\mathscr{M}\negthinspace\mathit{ap}} +\DeclareMathOperator{\bMap}{\mathbf{Map}} +\DeclareMathOperator{\uMap}{\underline{\mathrm{Map}}} + +\DeclareMathOperator{\Mor}{\mathrm{Mor}} +\DeclareMathOperator{\cMor}{\mathcal{M}\mathit{or}} +\DeclareMathOperator{\sMor}{\mathscr{M}\negthinspace\mathit{or}} +\DeclareMathOperator{\bMor}{\mathbf{Mor}} +\DeclareMathOperator{\uMor}{\underline{\mathrm{Mor}}} + +\DeclareMathOperator{\End}{\mathrm{End}} +\DeclareMathOperator{\cEnd}{\mathcal{E}\mathit{nd}} +\DeclareMathOperator{\sEnd}{\mathscr{E}\negthinspace\mathit{nd}} +\DeclareMathOperator{\bEnd}{\mathbf{End}} +\DeclareMathOperator{\uEnd}{\underline{\mathrm{End}}} + +\DeclareMathOperator{\Func}{\mathrm{Func}} +\DeclareMathOperator{\bFunc}{\mathbf{Func}} + +\DeclareMathOperator{\Nat}{\mathrm{Nat}} +\DeclareMathOperator{\bNat}{\mathbf{Nat}} + + +% Algebraic Geometry +%----------------------------- +% Categories +\newcommand*{\ctStack}{\mathbf{Stack}} +\newcommand*{\ctdStack}{\mathbf{dStack}} +\newcommand*{\ctdSch}{\mathbf{dSch}} +\newcommand*{\ctSch}{\mathbf{Sch}} +\newcommand*{\ctVar}{\mathbf{Var}} +\newcommand*{\ctProj}{\mathbf{Proj}} +\newcommand*{\ctqProj}{\mathbf{qProj}} +\newcommand*{\ctSm}{\mathbf{Sm}} +\newcommand*{\ctSmProj}{\mathbf{SmProj}} +\newcommand*{\ctCor}{\mathbf{Cor}} +\newcommand*{\ctM}{\mathbf{M}} +\newcommand*{\ctMM}{\mathbf{MM}} +\newcommand*{\ctCoh}{\mathbf{Coh}} +\newcommand*{\ctqCoh}{\mathbf{qCoh}} +\newcommand*{\ctConst}{\mathbf{Const}} +\newcommand*{\ctHdg}{\mathbf{Hdg}} +\newcommand*{\ctMHS}{\mathbf{MHS}} +\newcommand*{\ctHdgMod}{\mathbf{HdgMod}} +\newcommand*{\ctPerv}{\mathbf{Perv}} +\newcommand*{\ctBun}{\mathbf{Bun}} +\newcommand*{\ctLoc}{\mathbf{Loc}} +\newcommand*{\ctDMod}{\mathcal{D}\hy\mathbf{Mod}} +\newcommand*{\ctHrc}{\mathbf{Hrc}} +\newcommand*{\ctHypCov}{\mathbf{HypCov}} +\newcommand*{\ctCov}{\mathbf{Cov}} + +% Moduli spaces +\newcommand*{\Coh}{\mathrm{Coh}} +\newcommand*{\sCoh}{\mathscr{C}\negthinspace\mathit{oh}} +\newcommand*{\cCoh}{\mathcal{Coh}} +\newcommand*{\bCoh}{\mathbf{Coh}} + +\newcommand*{\Crys}{\mathrm{Crys}} +\newcommand*{\sCrys}{\mathscr{C}\negthinspace\mathit{rys}} +\newcommand*{\cCrys}{\mathcal{Crys}} +\newcommand*{\bCrys}{\mathbf{Crys}} + +\newcommand*{\Vect}{\mathrm{Vect}} +\newcommand*{\cVect}{\mathcal{Vect}} +\newcommand*{\sVect}{\mathscr{V}\negthickspace\mathit{ect}} +\newcommand*{\bVect}{\mathbf{Vect}} + +\newcommand*{\Bun}{\mathrm{Bun}} +\newcommand*{\cBun}{\mathcal{Bun}} +\newcommand*{\sBun}{\mathscr{B}\negthinspace\mathit{un}} +\newcommand*{\bBun}{\mathbf{Bun}} + +\newcommand*{\Loc}{\mathrm{Loc}} +\newcommand*{\cLoc}{\mathcal{Loc}} +\newcommand*{\sLoc}{\mathscr{L}\negthinspace\mathit{oc}} +\newcommand*{\bLoc}{\mathbf{Loc}} + +\newcommand*{\Hilb}{\mathrm{Hilb}} +\newcommand*{\cHilb}{\mathcal{Hilb}} +\newcommand*{\sHilb}{\mathscr{H}\negthinspace\mathit{ilb}} +\newcommand*{\bHilb}{\mathbf{Hilb}} + +\newcommand*{\Quot}{\mathrm{Quot}} +\newcommand*{\cQuot}{\mathcal{Quot}} +\newcommand*{\sQuot}{\mathscr{Q}\negthinspace\mathit{uot}} +\newcommand*{\bQuot}{\mathbf{Quot}} + +\newcommand*{\Pic}{\mathrm{Pic}} +\newcommand*{\cPic}{\mathcal{Pic}} +\newcommand*{\sPic}{\mathscr{P}\negthinspace\mathit{ic}} +\newcommand*{\bPic}{\mathbf{Pic}} + +\newcommand*{\Grass}{\mathrm{Grass}} +\newcommand*{\cGrass}{\mathcal{Grass}} +\newcommand*{\sGrass}{\mathscr{G}\negthinspace\mathit{rass}} +\newcommand*{\bGrass}{\mathbf{Grass}} + +\newcommand*{\Frob}{\mathrm{Frob}} + +\DeclareMathOperator{\Spec}{\mathrm{Spec}} +\DeclareMathOperator{\bSpec}{\mathbf{Spec}} +\DeclareMathOperator{\Proj}{\mathrm{Proj}} +\DeclareMathOperator{\bProj}{\mathbf{Proj}} + +\DeclareMathOperator{\Sing}{\mathrm{Sing}} +\DeclareMathOperator{\Cl}{\mathrm{Cl}} +\DeclareMathOperator{\CaCl}{\mathrm{CaCl}} +\DeclareMathOperator{\Div}{\mathrm{Div}} +\DeclareMathOperator{\divisor}{\mathrm{div}} +% \renewcommand*{\div}{\mathrm{\divisor}} % Hey, sure ?!? +\DeclareMathOperator{\Res}{\mathrm{Res}} +\DeclareMathOperator{\res}{\mathrm{res}} +\DeclareMathOperator{\Bl}{\mathrm{Bl}} +\DeclareMathOperator{\CH}{\mathrm{CH}} +\DeclareMathOperator{\Lsu}{\slashed{\Sigma}} +\DeclareMathOperator{\sh}{\mathrm{sh}} + + +\newcommand*{\nis}{\mathrm{nis}} % Nisnevich +\newcommand*{\zar}{\mathrm{zar}} % Zariski +\newcommand*{\et}{\mathrm{\acute et}} % Etale +\newcommand*{\cdh}{\mathrm{cdh}} % cdh +\newcommand*{\fppf}{\mathrm{fppf}} % fppf +\newcommand*{\fpqc}{\mathrm{fpqc}} % fpqc +\newcommand*{\crys}{\mathrm{crys}} % Crystalline +\newcommand*{\an}{\mathrm{an}} % analytic +\newcommand*{\red}{\mathrm{red}} % reduced +\newcommand*{\sst}{\mathrm{sst}} % simplicial semi-topological +\newcommand*{\rat}{\mathrm{rat}} % rational +\newcommand*{\num}{\mathrm{num}} % numerical +\newcommand*{\alg}{\mathrm{alg}} % algebraic +\newcommand*{\dR}{\mathrm{dR}} % de Rham +\newcommand*{\hdg}{\mathrm{hdg}} % Hodge +\newcommand*{\hol}{\mathrm{hol}} % Holonomic + +%\newcommand*{\hom}{\mathrm{hom}} % homological + + + +% Differential geometry +%----------------------------- +\newcommand*{\ctKah}{\mathbf{K\ddot{a}h}} +\newcommand*{\ctMan}{\mathbf{Man}} +\newcommand*{\ctSuMan}{\mathbf{SuMan}} +\newcommand*{\ctCpx}{\mathbf{Cpx}} +\newcommand*{\ctAlCpx}{\mathbf{AlCpx}} +\newcommand*{\ctSymp}{\mathbf{Symp}} + +\newcommand*{\ctFlatBun}{\mathbf{FlatBun}} +\newcommand*{\ctHiggs}{\mathbf{Higgs}} + + + +% Topology +%----------------------------- +\newcommand*{\ctpSh}{\mathbf{pSh}} +\newcommand*{\ctSh}{\mathbf{Sh}} +\newcommand*{\ctTop}{\mathbf{Top}} +\newcommand*{\ctSpc}{\mathbf{Spc}} +\newcommand*{\ctSpt}{\mathbf{Spt}} +\newcommand*{\ctCW}{\mathbf{CW}} +\newcommand*{\ctsSet}{\mathbf{sSet}} +\newcommand*{\ctKan}{\mathbf{Kan}} +\newcommand*{\ctHo}{\mathbf{Ho}} + +\DeclareMathOperator{\Cyl}{\mathrm{Cyl}} +\DeclareMathOperator{\Cone}{\mathrm{Cone}} + +\DeclareMathOperator{\ch}{\mathrm{ch}} +\DeclareMathOperator{\todd}{\mathrm{todd}} + +\newcommand*{\sing}{\mathrm{sing}} % Singular + + +% Operads +%----------------------------- +\newcommand*{\ctOp}{\mathbf{Op}} +\newcommand*{\ctdgOp}{\mathbf{dgOp}} + +\newcommand*{\opEnd}{\mathcal{E}\mathit{nd}} +\newcommand*{\opAss}{\mathcal{A}\mathit{ss}} +\newcommand*{\opLie}{\mathcal{L}\mathit{ie}} +\newcommand*{\opCom}{\mathcal{C}\!\mathit{om}} +\newcommand*{\opBV}{\mathcal{BV}} +\newcommand*{\opGer}{\mathcal{G}\!\mathit{er}} + + +% Algebra +%----------------------------- +\newcommand*{\ctArt}{\mathbf{Art}} +\newcommand*{\ctVect}{\mathbf{Vect}} +\newcommand*{\ctCh}{\mathbf{Ch}} +\newcommand*{\ctMod}{\mathbf{Mod}} +\newcommand*{\ctAb}{\mathbf{Ab}} +\newcommand*{\ctsAb}{\mathbf{sAb}} +\newcommand*{\ctGrp}{\mathbf{Grp}} +\newcommand*{\ctRng}{\mathbf{Rng}} +\newcommand*{\ctComRng}{\mathbf{ComRng}} +\newcommand*{\ctAlg}{\mathbf{Alg}} +\newcommand*{\ctsAlg}{\mathbf{sAlg}} +\newcommand*{\ctdgAlg}{\mathbf{dgAlg}} +\newcommand*{\ctAooAlg}{A^{\infty}\hy\mathbf{Alg}} + +\DeclareMathOperator{\Ext}{\mathrm{Ext}} +\DeclareMathOperator{\bExt}{\mathbf{Ext}} +\DeclareMathOperator{\sExt}{\mathscr{E}\negthickspace\mathit{xt}} + +\DeclareMathOperator{\Tor}{\mathrm{Tor}} +\DeclareMathOperator{\bTor}{\mathbf{Tor}} +\DeclareMathOperator{\sTor}{\mathscr{T}\negthickspace\mathit{or}} + +\DeclareMathOperator{\D}{\mathbf{D}} +\DeclareMathOperator{\Doo}{\mathbf{D_{\infty}}} +\DeclareMathOperator{\Gal}{\mathrm{Gal}} +\DeclareMathOperator{\Gr}{\mathrm{Gr}} +\DeclareMathOperator{\Sym}{\mathrm{Sym}} +\DeclareMathOperator{\Alt}{\mathrm{Alt}} +\DeclareMathOperator{\cha}{\mathrm{char}} +\DeclareMathOperator{\Tot}{\mathrm{Tot}} + +\newcommand*{\ssmpl}{\mathrm{ss}} % Semi simple + + +% Category Theory +%----------------------------- +\newcommand*{\ctSet}{\mathbf{Set}} +\newcommand*{\ctCat}{\mathbf{Cat}} +\newcommand*{\ctGpd}{\mathbf{Gpd}} +\newcommand*{\ctooCat}{\infty\hy\mathbf{Cat}} +\newcommand*{\ctooGpd}{\infty\hy\mathbf{Gpd}} +\newcommand*{\ctdgCat}{\mathbf{dgCat}} +\newcommand*{\ctStab}{\mathbf{Stab}} +\newcommand*{\ctAooCat}{A^{\infty}\hy\mathbf{Cat}} + +\newcommand*{\ctArr}{\mathbf{Arr}} +\newcommand*{\ctDiag}{\mathbf{Diag}} +\newcommand*{\ctcoDiag}{\mathbf{coDiag}} +\newcommand*{\ctSpan}{\mathbf{Span}} +\newcommand*{\Typ}{\mathrm{Typ}} + +\newcommand*{\op}{\mathrm{op}} % Opposite category +\newcommand*{\ctu}{\mathbf{1}} % Monoidal unit + + +% Analysis +%----------------------------- +\newcommand\pder[2]{\frac{\partial #1}{\partial #2}} +\WithSuffix\newcommand\pder*[2]{\sfrac{\partial #1}{\partial #2}} +\newcommand\dder[2]{\frac{\mathrm{d} #1}{\mathrm{d} #2}} +\WithSuffix\newcommand\dder*[2]{\sfrac{\mathrm{d} #1}{\mathrm{d} #2}} + + +% Lie Groups and Lie algebras +%----------------------------- +\newcommand*{\lieSL}{\mathrm{SL}} +\newcommand*{\lieGL}{\mathrm{GL}} +\newcommand*{\lieSO}{\mathrm{SO}} +\newcommand*{\lieO}{\mathrm{O}} +\newcommand*{\lieU}{\mathrm{U}} +\newcommand*{\lieSU}{\mathrm{SU}} +\newcommand*{\lieSp}{\mathrm{Sp}} + +\newcommand*{\liesl}{\mathfrak{sl}} +\newcommand*{\liegl}{\mathfrak{gl}} +\newcommand*{\lieso}{\mathfrak{so}} +\newcommand*{\lieo}{\mathfrak{o}} +\newcommand*{\lieu}{\mathfrak{u}} +\newcommand*{\liesu}{\mathfrak{su}} +\newcommand*{\liesp}{\mathfrak{sp}} + + +% Shortcuts for sub and superscripts. + +%\newcommand*{\top}{\mathrm{top}} % topological +%\newcommand*{\b}{\mathrm{b}} % bounded + + +% Miscelania +%----------------------------- +\DeclareMathOperator{\codim}{\mathrm{codim}} +\DeclareMathOperator{\rank}{\mathrm{rank}} +\DeclareMathOperator{\tr}{\mathrm{tr}} +\DeclareMathOperator{\Supp}{\mathrm{Supp}} +\DeclareMathOperator{\supp}{\mathrm{supp}} diff --git a/lib/abdocolor.sty b/lib/abdocolor.sty new file mode 100644 index 0000000..6c8d981 --- /dev/null +++ b/lib/abdocolor.sty @@ -0,0 +1,328 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{abdocolor} + + +%% Options +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hooks +\newcommand{\colorshook}{\setdefaultcolors} + +% Light option +\DeclareOption{lightcolors}{ + \renewcommand{\colorshook}{\setlightcolors} +} + +% Colors for the web +\DeclareOption{webcolors}{ + \renewcommand{\colorshook}{\setwebcolors} +} + +% Dark option +\DeclareOption{darkcolors}{ + \renewcommand{\colorshook}{\setdarkcolors} +} + +\DeclareOption{bwcolors}{ + \renewcommand{\colorshook}{\setbwcolors} +} + + +\ProcessOptions + + +%% Package Loading +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\RequirePackage{xcolor} + + +%% Colors +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% light background colors +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\definecolor{lightgreen}{HTML}{80AF7F} +\definecolor{darkred}{HTML}{C62424} +\definecolor{darkgreen}{HTML}{09873B} +\definecolor{darkblue}{HTML}{3661CF} +\definecolor{darkorange}{HTML}{DD501F} + + +% Reversed zenburn colors +% (they become nice zenburn under recolor) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\definecolor{zenrev-darkred}{HTML}{9F3131} +\definecolor{zenrev-darkgreen}{HTML}{007700} +\definecolor{zenrev-lightgreen}{HTML}{80AF7F} +\definecolor{zenrev-darkblue}{HTML}{10686D} +\definecolor{zenrev-darkorange}{HTML}{FE5C00} + + +% Zenburn colors +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\definecolor{zenburn-fg}{HTML}{DCDCCC} +\definecolor{zenburn-bg}{HTML}{2F2F2F} + +\definecolor{zenburn-red}{HTML}{CC9393} +\definecolor{zenburn-red-1}{HTML}{BC8383} +\definecolor{zenburn-orange}{HTML}{DFAF8F} +\definecolor{zenburn-green}{HTML}{7F9F7F} +\definecolor{zenburn-green-1}{HTML}{5F7F5F} +\definecolor{zenburn-blue}{HTML}{8CD0D3} +\definecolor{zenburn-blue-1}{HTML}{7CB8BB} + +% Saturated Zenburn colors +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\definecolor{zenburn-sat-orange}{HTML}{FF7F41} +\definecolor{zenburn-sat-orange-1}{HTML}{DD7621} +\definecolor{zenburn-sat-red}{HTML}{EE3B3B} +\definecolor{zenburn-sat-red-1}{HTML}{CD3333} +\definecolor{zenburn-sat-lightgreen}{HTML}{9AFF9A} +\definecolor{zenburn-sat-lightgreen-1}{HTML}{7CCD7C} +\definecolor{zenburn-sat-green}{HTML}{00CD66} +\definecolor{zenburn-sat-green-1}{HTML}{008B45} +\definecolor{zenburn-sat-blue}{HTML}{1E90FF} +\definecolor{zenburn-sat-blue-1}{HTML}{3A5FCD} + + +% Slides colors +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% sat: 43, val: 72 +\definecolor{slides-orange}{HTML}{B78B69} % hue: 27 +\definecolor{slides-red}{HTML}{B76969} % hue: 0 +\definecolor{slides-green}{HTML}{69B769} % hue: 120 +\definecolor{slides-blue}{HTML}{698BB7} % hue: 214 + +% sat: 75, val: 93 +\definecolor{slides-sat-orange}{HTML}{EC8A3B} +\definecolor{slides-sat-red}{HTML}{EC3B3B} +\definecolor{slides-sat-green}{HTML}{3BEC3B} +\definecolor{slides-sat-blue}{HTML}{3B88EC} + +% sat: 39, val: 96 +\definecolor{slides-light-orange}{HTML}{F5C095} +\definecolor{slides-light-red}{HTML}{F59595} +\definecolor{slides-light-green}{HTML}{95F595} +\definecolor{slides-light-blue}{HTML}{95BFF5} + +% gray +\definecolor{slides-gray}{HTML}{B8B8B8} + + + + +%% Color Modifications +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Conservative defaults +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcommand{\setdefaultcolors}{ + % main + \colorlet{backgroundcolor}{white} + \colorlet{textcolor}{black} + \colorlet{emphcolor}{black} + + % draftools + \colorlet{diffbarcolor}{darkred} + \colorlet{diffdelcolor}{darkred} + \colorlet{diffaddcolor}{darkblue} + + \colorlet{revinfocolor}{black} + \colorlet{revwarncolor}{darkred} + \colorlet{cmtcolor}{lightgreen} + + \colorlet{sklabelcolor}{black} + \colorlet{skrefcolor}{black} + + % hyperref + \colorlet{linkcolor}{darkred} + \colorlet{citecolor}{darkred} + \colorlet{filecolor}{black} + \colorlet{urlcolor}{darkblue} + + % sectioning + \colorlet{chaptercolor}{textcolor} + \colorlet{section1color}{textcolor} + \colorlet{section2color}{textcolor} + \colorlet{section3color}{textcolor} + \colorlet{paragraphcolor}{textcolor} + + % theorems + \colorlet{thmcolor}{textcolor} + \colorlet{dfncolor}{textcolor} +} + + +% Colorful with light background +% (once reversed with recolor become zenburn) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcommand{\setlightcolors}{ + % main + \colorlet{backgroundcolor}{white} + \colorlet{textcolor}{black} + \colorlet{emphcolor}{zenrev-darkgreen} + + % draftools + \colorlet{diffbarcolor}{zenrev-darkred} + \colorlet{diffdelcolor}{zenrev-darkred} + \colorlet{diffaddcolor}{zenrev-darkblue} + + \colorlet{revinfocolor}{black} + \colorlet{revwarncolor}{zenrev-darkred} + \colorlet{cmtcolor}{zenrev-lightgreen} + + \colorlet{sklabelcolor}{zenrev-darkgreen} + \colorlet{skrefcolor}{zenrev-darkgreen} + + % hyperref + \colorlet{linkcolor}{zenrev-darkred} + \colorlet{citecolor}{zenrev-darkred} + \colorlet{filecolor}{black} + \colorlet{urlcolor}{zenrev-darkblue} + + % sectioning + \colorlet{chaptercolor}{zenrev-darkorange} + \colorlet{section1color}{zenrev-darkorange} + \colorlet{section2color}{zenrev-darkorange} + \colorlet{section3color}{zenrev-darkorange} + \colorlet{paragraphcolor}{zenrev-darkorange} + + % theorems + \colorlet{thmcolor}{zenrev-darkblue} + \colorlet{dfncolor}{zenrev-darkblue} +} + + +% Colorful. For the web +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcommand{\setwebcolors}{ + % main + \colorlet{backgroundcolor}{white} + \colorlet{textcolor}{black} + \colorlet{emphcolor}{darkgreen} + + % draftools + \colorlet{diffbarcolor}{darkred} + \colorlet{diffdelcolor}{darkred} + \colorlet{diffaddcolor}{darkblue} + + \colorlet{revinfocolor}{black} + \colorlet{revwarncolor}{darkred} + \colorlet{cmtcolor}{zenburn-green-1} + + \colorlet{sklabelcolor}{darkgreen} + \colorlet{skrefcolor}{darkgreen} + + % hyperref + \colorlet{linkcolor}{darkred} + \colorlet{citecolor}{darkred} + \colorlet{filecolor}{black} + \colorlet{urlcolor}{darkblue} + + % sectioning + \colorlet{chaptercolor}{black} + \colorlet{section1color}{black} + \colorlet{section2color}{black} + \colorlet{section3color}{black} + \colorlet{paragraphcolor}{black} + + % theorems + \colorlet{thmcolor}{darkorange} + \colorlet{dfncolor}{darkorange} +} + + +% Colorful with dark background +% (zenburn) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcommand{\setdarkcolors}{ + % main + \colorlet{backgroundcolor}{zenburn-bg} + \colorlet{textcolor}{zenburn-fg} + \colorlet{emphcolor}{zenburn-sat-lightgreen-1} + + % draftools + \colorlet{diffbarcolor}{zenburn-red} + \colorlet{diffdelcolor}{zenburn-red} + \colorlet{diffaddcolor}{zenburn-blue} + + \colorlet{revinfocolor}{textcolor} + \colorlet{revwarncolor}{zenburn-red} + \colorlet{cmtcolor}{zenburn-green-1} + + \colorlet{sklabelcolor}{zenburn-sat-lightgreen-1} + \colorlet{skrefcolor}{zenburn-sat-lightgreen-1} + + % hyperref + \colorlet{linkcolor}{zenburn-red} + \colorlet{citecolor}{zenburn-red} + \colorlet{filecolor}{textcolor} + \colorlet{urlcolor}{zenburn-blue} + + % sectioning + \colorlet{chaptercolor}{zenburn-sat-orange-1} + \colorlet{section1color}{zenburn-sat-orange-1} + \colorlet{section2color}{zenburn-sat-orange-1} + \colorlet{section3color}{zenburn-sat-orange-1} + \colorlet{paragraphcolor}{zenburn-sat-orange-1} + + % theorems + \colorlet{thmcolor}{zenburn-blue-1} + \colorlet{dfncolor}{zenburn-blue-1} +} + +% Black and White +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcommand{\setbwcolors}{ + % main + \colorlet{backgroundcolor}{white} + \colorlet{textcolor}{black} + \colorlet{emphcolor}{black} + + % draftools + \colorlet{diffbarcolor}{black} + \colorlet{diffdelcolor}{black} + \colorlet{diffaddcolor}{black} + + \colorlet{revinfocolor}{black} + \colorlet{revwarncolor}{black} + \colorlet{cmtcolor}{black} + + \colorlet{sklabelcolor}{black} + \colorlet{skrefcolor}{black} + + % hyperref + \colorlet{linkcolor}{black} + \colorlet{citecolor}{black} + \colorlet{filecolor}{black} + \colorlet{urlcolor}{black} + + % sectioning + \colorlet{chaptercolor}{textcolor} + \colorlet{section1color}{textcolor} + \colorlet{section2color}{textcolor} + \colorlet{section3color}{textcolor} + \colorlet{paragraphcolor}{textcolor} + + % theorems + \colorlet{thmcolor}{textcolor} + \colorlet{dfncolor}{textcolor} +} + + + +%% Run Hooks +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\colorshook % Set the colors diff --git a/lib/abdofonts.sty b/lib/abdofonts.sty new file mode 100644 index 0000000..25a2ad6 --- /dev/null +++ b/lib/abdofonts.sty @@ -0,0 +1,48 @@ +% ----------------------------------------------------------------------- % +% File: abdofonts.sty Font settings % +% Author: Abdó Roig-Maranges 2013 % +% ----------------------------------------------------------------------- % + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{abdofonts} + +\RequirePackage{iftex} % Do conditionals on tex engine +\RequirePackage{amsfonts} % AMS fonts + + +\newcommand{\abdo@otfonts}{ + % Text fonts + \setmainfont[Ligatures=TeX]{TeX Gyre Pagella} + \setsansfont[Ligatures=TeX]{TeX Gyre Heros} + \setmonofont{Ubuntu Mono} + + % Math fonts + \setmathfont[math-style=TeX]{TeX Gyre Pagella Math} + \setmathfont[math-style=TeX,range={\mathcal,\mathbfcal}]{Latin Modern Math} + \setmathfont[math-style=TeX,range={\mathscr,\mathbfscr}]{Asana Math} + % \setmathfont[math-style=TeX]{Asana Math} + % \setmathfont[math-style=TeX]{XITS Math} + % \setmathfont[math-style=TeX]{Latin Modern Math} +} + + +\newcommand{\abdo@mffonts}{ + \RequirePackage{palatino} + \RequirePackage{mathpazo} + \RequirePackage{mathrsfs} % Ralph Smith Formal Script font. +} + + +\ifLuaTeX + \RequirePackage{fontspec} + \RequirePackage{unicode-math} + \RequirePackage{lualatex-math} % temporary kludge to fix some lualatex math issues. + + \abdo@otfonts + +\else + \RequirePackage[utf8]{inputenc} + \RequirePackage[T1]{fontenc} + + \abdo@mffonts +\fi diff --git a/lib/abdokoma.sty b/lib/abdokoma.sty new file mode 100644 index 0000000..e0dbe4f --- /dev/null +++ b/lib/abdokoma.sty @@ -0,0 +1,268 @@ +% ----------------------------------------------------------------------- % +% File: koma.sty KOMA customizations % +% Author: Abdó Roig-Maranges 2012-2013 % +% ----------------------------------------------------------------------- % + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{abdokoma} + + + +% ----------------------------------------------------------------------- % +% Layout % +% ----------------------------------------------------------------------- % + +% Linespread +\newcommand{\widelinespread}{\linespread{1.3}} +\newcommand{\regularlinespread}{\linespread{1}} + + + +% ----------------------------------------------------------------------- % +% Options % +% ----------------------------------------------------------------------- % + +% Hooks +\providecommand{\hyperrefhook}{} +\providecommand{\sectioninghook}{} + + +% Draft option +\DeclareOption{draft}{ + \ExecuteOptions{regularspread} + \PassOptionsToPackage{showkeys}{draftools} +} + + +% Line spread options +\DeclareOption{widespread}{ + \widelinespread +} +\DeclareOption{regularspread}{ + \regularlinespread +} + + +% Hyperref option +\DeclareOption{hyperref}{ + \PassOptionsToPackage{final}{hyperref} + \renewcommand{\hyperrefhook}{% + \hypersetup{% + pdfencoding=auto,% + unicode,% + psdextra,% + pdftitle={\@title},% + pdfauthor={\@author},% + colorlinks,% + citecolor=citecolor,% + filecolor=filecolor,% + linkcolor=linkcolor,% + urlcolor=urlcolor% + }% + } +} + +\DeclareOption{nohyperref}{ + \PassOptionsToPackage{draft}{hyperref} + \renewcommand{\hyperrefhook}{} +} + +% Sectioning depth (tocdepth3 means paragraph is depth 3, after section and +% subsection) +\DeclareOption{tocdepth3}{ + \renewcommand{\sectioninghook}{ + \setupsectioning{3} + \@ifclassloaded{scrreprt}{\setupchapterpart}{} + \@ifclassloaded{scrbook}{\setupchapterpart}{} + } +} + +\DeclareOption{tocdepth2}{ + \renewcommand{\sectioninghook}{ + \setupsectioning{2} + \@ifclassloaded{scrreprt}{\setupchapterpart}{} + \@ifclassloaded{scrbook}{\setupchapterpart}{} + } +} + + +% Defaults +\ExecuteOptions{tocdepth3} +\ExecuteOptions{hyperref} +\ExecuteOptions{regularspread} + + +% Process options of the package. +\ProcessOptions + +% Delay options to be processed. +\AtBeginDocument{\setupheader} + + + +% ----------------------------------------------------------------------- % +% Package loading % +% ----------------------------------------------------------------------- % + +% NOTE: without etex, tikz + beamer complain about not enough room for dimendions. +\RequirePackage{etex} % etex stuff +\RequirePackage{iftex} % conditionals on tex engine +\RequirePackage{ifpdf} % conditional on pdf output + +% NOTE: needed on texlive 2016 due to some packages not following recent lualatex changes. +\ifLuaTeX + \RequirePackage{luatex85} +\fi + +\RequirePackage{babel} % language support +\RequirePackage[nodayofweek]{datetime} % date formating + +%\RequirePackage{etoolbox} % e-tex tools +%\RequirePackage{ifthen} % Make decisions inside latex +%\RequirePackage{calc} % Arithmetic with lengths +%\RequirePackage{xparse} % Extended command definitions +%\RequirePackage{xkeyval} % Use of Key value pairs + +% page layout +\RequirePackage{geometry} % Geometry of the page +\RequirePackage[automark]{scrpage2} % Customizing headings +\RequirePackage{titletoc} % Tweaking TOC + +% bibliography +\RequirePackage[autostyle]{csquotes} % quotation (required by biblatex). +\RequirePackage[ % Bibliography + backend=biber, + style=numeric, + url=false, + doi=true, + eprint=true +]{biblatex} + +% biblatex tweaks +\renewbibmacro{in:}{} + +% ams +\RequirePackage{amsmath} % AMS stuff + +% graphics and color +\RequirePackage{xcolor} % provides color +\RequirePackage{graphicx} % Include external graphics + +\ifpdf + \RequirePackage{tikz} % Graphics + \usetikzlibrary{matrix} + \usetikzlibrary{calc} + \usetikzlibrary{decorations.markings} + \usetikzlibrary{cd} + \tikzcdset{arrow style=tikz} +\fi + +% personal +\RequirePackage{abdocolor} % Custom colors +\RequirePackage{abdoalias} % My aliases +\RequirePackage{abdofonts} % My font settings +\RequirePackage{abdothms} % My theorems +\RequirePackage{draftools} % Various draft tools + +% typesetting tools +\RequirePackage{url} % provides URL typesetting + +% NOTE: hyperref must load last, or it breaks showkeys... +\RequirePackage{hyperref} + +% NOTE: but cleveref must load after hyperref +\RequirePackage[ % Smart references + noabbrev, + capitalise +]{cleveref} + + + +% ----------------------------------------------------------------------- % +% Visual appearence % +% ----------------------------------------------------------------------- % + +% change emph +\let\emphold\emph +\renewcommand{\emph}[1]{\textbf{\color{emphcolor}#1}} + + +\newcommand{\setupheader}{% + \setkomafont{pageheadfoot}{\sffamily} + \pagestyle{scrheadings}% + \setheadsepline{0.0pt}% + \ihead{\headmark} \chead{} \ohead{}% + %\ifoot{} \cfoot{} \ofoot{}% +} + + +\newcommand{\setupsectioning}[1]{ + % section colors + \addtokomafont{section}{\color{section1color}} + \addtokomafont{subsection}{\color{section2color}} + \addtokomafont{subsubsection}{\color{section3color}} + \addtokomafont{paragraph}{\color{paragraphcolor}} + \pagecolor{backgroundcolor} + \color{textcolor} + + \setcounter{tocdepth}{4} + + \renewcommand*{\toclevel@section}{1} + \renewcommand*{\toclevel@subsection}{2} + + \def\sectioning@argument{#1} + \if\sectioning@argument2 + \def\sectioning@paragraphmargin{2.5em} + \renewcommand*{\toclevel@paragraph}{2} + \else + \def\sectioning@paragraphmargin{4.5em} + \renewcommand*{\toclevel@paragraph}{3} + \fi + + % table of contents style (titletoc) + \titlecontents{section}[1em]{\bfseries\sffamily\vspace*{1ex}}{\thecontentslabel. } + {}{\titlerule*[1pc]{}\thecontentspage}[] + + \titlecontents{subsection}[2.5em]{}{\sffamily\thecontentslabel. } + {}{\ \titlerule*[1em]{$\cdot$}\ \thecontentspage}[] + + \titlecontents*{paragraph}[\sectioning@paragraphmargin]{\sffamily\itshape\small}{\thecontentslabel. } + {}{\, \thecontentspage}[\hspace*{0.5em} -- \hspace*{0.5em}] +} + + +\newcommand{\setupchapterpart}{ + % chapter and part colors + \addtokomafont{part}{\color{chaptercolor}} + \addtokomafont{chapter}{\color{chaptercolor}} + + % table of contents style + \renewcommand*{\toclevel@part}{-1} + \titlecontents{part}[0pt]{\bfseries\sffamily\Large\vspace*{1ex}}{\thecontentslabel. } + {}{}[] + + \renewcommand*{\toclevel@chapter}{0} + \titlecontents{chapter}[0pt]{\bfseries\sffamily\vspace*{1ex}}{\thecontentslabel. } + {}{\titlerule*[1pc]{}\thecontentspage}[] +} + + + +% ----------------------------------------------------------------------- % +% Miscelania % +% ----------------------------------------------------------------------- % + +% Unnumbereds footnotes +\def\unfootnote{\xdef\@thefnmark{}\@footnotetext} + + +% Shortcut to select a tex-title and an alternate string to embed in pdf's +\newcommand{\texorpdf}[2]{\texorpdfstring{#1}{#2}} + + + +% ----------------------------------------------------------------------- % +% Run hooks % +% ----------------------------------------------------------------------- % +\hyperrefhook +\sectioninghook \ No newline at end of file diff --git a/lib/abdothms.sty b/lib/abdothms.sty new file mode 100644 index 0000000..8a0b359 --- /dev/null +++ b/lib/abdothms.sty @@ -0,0 +1,164 @@ +\NeedsTeXFormat{LaTeX2e} + +\ProvidesPackage{abdothms} + + +\newcommand{\theoremshook}{} + +\DeclareOption{catalan}{ + \renewcommand{\theoremshook}{\theoremscatalan} +} + +\DeclareOption{english}{ + \renewcommand{\theoremshook}{\theoremsenglish} +} + +\DeclareOption{spanish}{ + \renewcommand{\theoremshook}{\theoremsspanish} +} + + +% Process options of the package. +\ProcessOptions + + +%% Package Loading +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\RequirePackage{amsthm} % AMS theorem environments +\RequirePackage{ifthen} % Make decisions inside latex + + +%% Theorems +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Creates a new theorem environment. +% Parameters: label, text, short text, thm style, enum style, enum param. +% Example: \maketheoremenv{thm}{Theorem}{plain}{counter}{section} +% Example: \maketheoremenv{dfn}{Definition}{definition}{copy}{thm} + +\newcommand{\maketheoremenv}[6]{ + \theoremstyle{#4}% + \ifthenelse{\equal{#5}{counter}}{% + \newtheorem{#1}{#2}[#6]% + }{}% + \ifthenelse{\equal{#5}{copy}}{% + \newtheorem{#1}[#6]{#2}% + }{}% +} + +\DeclareRobustCommand{\blackcircle}{\LARGE$\bullet$} + +\newcommand{\makeproofenv}[4]{ + \newenvironment{#1}[1][]{\par% + \renewcommand{\qedsymbol}{#4}% + \pushQED{\qed}% + \normalfont \topsep6\p@\@plus6\p@\relax% + \trivlist + \ifx @##1@% + \item[\hskip\labelsep% + {\bfseries #2\@addpunct{.}}] + \else% + \item[\hskip\labelsep% + {\bfseries #2 (##1)\@addpunct{.}}] + \fi% + \ignorespaces% + }{% + \popQED\endtrivlist\@endpefalse% + \aftergroup\ignorespaces% + } +} + +% Disable ams proof. Having both around might lead to inconsistent +% usage of the proof environment... + +\renewenvironment{proof}[1][]{\errmessage{Proof environment disabled. Use prf instead !}}{} + +\newcommand{\theoremscatalan}{ + \maketheoremenv{thm}{\color{thmcolor}Teorema}{Tma.}{definition}{counter}{section} + \maketheoremenv{prp}{\color{thmcolor}Proposici\'o}{Prop.}{definition}{copy}{thm} + \maketheoremenv{lem}{\color{thmcolor}Lema}{Lem.}{definition}{copy}{thm} + \maketheoremenv{cor}{\color{thmcolor}Coro\l.lari}{Cor.}{definition}{copy}{thm} + \maketheoremenv{con}{\color{thmcolor}Conjectura}{Conj.}{definition}{copy}{thm} + + \maketheoremenv{dfn}{\color{dfncolor}Definici\'o}{Def.}{definition}{copy}{thm} + \maketheoremenv{rmk}{\color{dfncolor}Remarca}{Rem.}{definition}{copy}{thm} + \maketheoremenv{obs}{\color{dfncolor}Observaci\'o}{Obs.}{definition}{copy}{thm} + \maketheoremenv{nte}{\color{dfncolor}Nota}{Nota}{definition}{copy}{thm} + \maketheoremenv{exm}{\color{dfncolor}Exemple}{Exm.}{definition}{copy}{thm} + + \maketheoremenv{exr}{Exercici}{Exr.}{definition}{counter}{section} + \maketheoremenv{prb}{Problema}{Prob.}{definition}{copy}{exr} + \maketheoremenv{que}{Q\"uesti\'o}{Q\"ue.}{definition}{copy}{exr} + + \maketheoremenv{blk}{}{}{definition}{counter}{section} + + \makeproofenv{sol}{Soluci\'o}{Sol.}{\blackcircle} + \makeproofenv{ans}{Resposta}{Res.}{\blackcircle} + \makeproofenv{prf}{Demostraci\'o}{Dem.}{\blackcircle} +} + +\newcommand{\theoremsenglish}{ + \maketheoremenv{thm}{\color{thmcolor}Theorem}{Thm.}{definition}{counter}{section} + \maketheoremenv{prp}{\color{thmcolor}Proposition}{Prop.}{definition}{copy}{thm} + \maketheoremenv{lem}{\color{thmcolor}Lemma}{Lem.}{definition}{copy}{thm} + \maketheoremenv{cor}{\color{thmcolor}Corollary}{Cor.}{definition}{copy}{thm} + \maketheoremenv{con}{\color{thmcolor}Conjecture}{Conj.}{definition}{copy}{thm} + + \maketheoremenv{dfn}{\color{dfncolor}Definition}{Def.}{definition}{copy}{thm} + \maketheoremenv{rmk}{\color{dfncolor}Remark}{Rem.}{definition}{copy}{thm} + \maketheoremenv{obs}{\color{dfncolor}Observation}{Obs.}{definition}{copy}{thm} + \maketheoremenv{nte}{\color{dfncolor}Note}{Note}{definition}{copy}{thm} + \maketheoremenv{exm}{\color{dfncolor}Example}{Exm.}{definition}{copy}{thm} + + \maketheoremenv{exr}{Exercise}{Exr.}{definition}{counter}{section} + \maketheoremenv{prb}{Problem}{Prb.}{definition}{copy}{exr} + \maketheoremenv{que}{Question}{Que.}{definition}{copy}{exr} + + \maketheoremenv{blk}{}{}{definition}{counter}{section} + + \makeproofenv{sol}{Solution}{Sol.}{\blackcircle} + \makeproofenv{ans}{Answer}{Ans.}{\blackcircle} + \makeproofenv{prf}{Proof}{Prf.}{\blackcircle} +} + +\newcommand{\theoremsspanish}{ + \maketheoremenv{thm}{\color{thmcolor}Teorema}{Tma.}{definition}{counter}{section} + \maketheoremenv{prp}{\color{thmcolor}Proposici\'on}{Prop.}{definition}{copy}{thm} + \maketheoremenv{lem}{\color{thmcolor}Lema}{Lem.}{definition}{copy}{thm} + \maketheoremenv{cor}{\color{thmcolor}Corolario}{Cor.}{definition}{copy}{thm} + \maketheoremenv{con}{\color{thmcolor}Conjetura}{Conj.}{definition}{copy}{thm} + + \maketheoremenv{dfn}{\color{dfncolor}Definici\'on}{Def.}{definition}{copy}{thm} + \maketheoremenv{rmk}{\color{dfncolor}Remarca}{Rem.}{definition}{copy}{thm} + \maketheoremenv{obs}{\color{dfncolor}Observaci\'on}{Obs.}{definition}{copy}{thm} + \maketheoremenv{nte}{\color{dfncolor}Nota}{Nota}{definition}{copy}{thm} + \maketheoremenv{exm}{\color{dfncolor}Ejemplo}{Ejm.}{definition}{copy}{thm} + + \maketheoremenv{exr}{Ejercicio}{Ejer.}{definition}{counter}{section} + \maketheoremenv{prb}{Problema}{Prob.}{definition}{copy}{exr} + \maketheoremenv{que}{Questi\'on}{Que.}{definition}{copy}{exr} + + \maketheoremenv{blk}{}{}{definition}{counter}{section} + + \makeproofenv{sol}{Soluci\'on}{Sol.}{\blackcircle} + \makeproofenv{ans}{Respuesta}{Res.}{\blackcircle} + \makeproofenv{prf}{Demostraci\'on}{Dem.}{\blackcircle} +} + + +% Mimic the numbering of an other theorem, to be used in introductions and such. +\newenvironment{thmref}[1] +{% + \bgroup% + \renewcommand{\thethm}{\ref*{#1}}% + \thm% +}{% + \endthm% + \addtocounter{thm}{-1}% + \egroup% +} + + +\theoremshook % Creates all the theorems in the + % appropriate language. diff --git a/lib/draftools.lua b/lib/draftools.lua new file mode 100644 index 0000000..86c237e --- /dev/null +++ b/lib/draftools.lua @@ -0,0 +1,165 @@ + +-- requires +lfs = require("lfs") + +-- global state +userdata = userdata or {} +userdata.state = userdata.state or {} +userdata.revinfo = userdata.revinfo or {} + +userdata.state.showcomments = false + + + +local draftools={} + + +-- parses an active comment '%!' and returns the appropriate text +function draftools.parse_active_comments (line) + + -- If active comments is disabled, just return as it is. + if not userdata.state.showcomments then + return line + end + + -- Process active comments beginning with "%!" + local a,b,m,sp + a,b,sp,m = string.find(line, "%s*%%!(%s*)(.*)") + + if not sp then sp = "" end + local indent = string.len(sp) + if indent > 0 then indent = indent - 1 end + + local space + if indent > 0 then + space = "\\hspace*{" .. tostring(indent/2.) .. "em}" + else + space = "" + end + + if m then + return "\\begincmt{}" .. space .. m .. "\\endcmt{}" + else + return line + end +end + + + +--------------------------------------------------------------------------- +-- Revinfo -- +--------------------------------------------------------------------------- + +-- default lib source +local INDEX = "INDEX" + + +-- checks whether working dir is clean +local function workingdir_clean() + local out=io.popen('git status --porcelain', 'r') + if out then + local raw = out:read("*all"):gsub("^%s*(.-)%s*$", "%1") + return string.len(raw) > 0 + else + return false + end +end + + +-- checks whether working dir is managed by git +local function is_git_repo() + return lfs.attributes('.git', 'mode') == 'directory' +end + + +-- extract revision data from git +local function get_revision_data(rev) + if rev == INDEX then gitrev = "HEAD" + else gitrev = rev end + + local rd = {} + local out=io.popen('git --no-pager log -1 --pretty="%h%n%H%n%an <%ae>%n%ai%n%s" ' .. gitrev, 'r') + if out then + local raw = out:read("*all") + local t1,t2,t3,t4,t5 = raw:match("(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n") + rd.shorthash = t1 or "unk" + rd.hash = t2 or "unknown" + rd.author = t3 or "???" + rd.summary = t5 or "" + + if rev == INDEX then + rd.clean = workingdir_clean() + local outdate = io.popen('date --rfc-3339=seconds') + t4 = outdate:read("*all") + else + rd.clean = true + end + + if t4 then + rd.date = t4:match("(%d+%-%d+%-%d+)") + rd.time = t4:match("(%d+:%d+):%d+") + else + rd.date = "???" + rd.time = "???" + end + + return rd + end +end + + +-- sets the workingdir revision +function draftools.set_workingdir_revinfo() + userdata.state.diffmode = false + userdata.revinfo = {} + + if is_git_repo() then + userdata.revinfo.rev = get_revision_data(INDEX) + end +end + + +-- sets the diff revision +function draftools.set_diff_revinfo(revA, revB) + userdata.state.diffmode = true + userdata.revinfo = {} + + if is_git_repo() then + userdata.revinfo.revA = get_revision_data(revA) + userdata.revinfo.revB = get_revision_data(revB) + end +end + + +-- typesets revision information +function draftools.print_revinfo_header() + if userdata.state.diffmode then + local revA = userdata.revinfo.revA + local revB = userdata.revinfo.revB + + local hashA = revA.shorthash + if not revA.clean then hashA = hashA .. "+" end + + local hashB = revA.shorthash + if not revB.clean then hashB = hashB .. "+" end + + + tex.print(string.format("%s & %s %s & %s\\\\", hashA, + revA.date, revA.time, revA.summary)) + tex.print(string.format("%s & %s %s & %s\\\\", hashB, + revB.date, revB.time, revB.summary)) + return nil + else + local rev = userdata.revinfo.rev + local hash = rev.shorthash + if not rev.clean then hash = hash .. "+" end + + + tex.print(string.format("%s & %s %s & %s", hash, + rev.date, rev.time, rev.summary)) + end +end + + + +return draftools diff --git a/lib/draftools.sty b/lib/draftools.sty new file mode 100644 index 0000000..2307dcc --- /dev/null +++ b/lib/draftools.sty @@ -0,0 +1,340 @@ +% ----------------------------------------------------------------------- % +% File: draftools.sty Some tools for managing drafts % +% Author: Abdó Roig-Maranges 2011-2013 % +% ----------------------------------------------------------------------- % + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{draftools} + + +% ----------------------------------------------------------------------- % +% Options % +% ----------------------------------------------------------------------- % + +% Hooks +\providecommand{\showkeyshook}{} +\providecommand{\showkeyshackshook}{} +\providecommand{\visualdbghook}{} +\providecommand{\showcommentshook}{} +\providecommand{\revinfoheaderhook}{} + + +% Showkeys options +\DeclareOption{onlylabels}{ + \PassOptionsToPackage{notref,notcite}{showkeys} +} + +\DeclareOption{showkeys}{ + \renewcommand{\showkeyshook}{\RequirePackage{showkeys}} + \renewcommand{\showkeyshackshook}{\makeshowkeyshacks} +} + +\DeclareOption{noshowkeys}{ + \renewcommand{\showkeyshook}{} + \renewcommand{\showkeyshackshook}{} +} + +\DeclareOption{visualdbg}{ + \renewcommand{\visualdbghook}{\RequirePackage{lua-visual-debug}} +} + +\DeclareOption{showcomments}{ + \renewcommand\showcommentshook{\showcomments} +} + +\DeclareOption{noshowcomments}{ + \renewcommand\showcommentshook{\hidecomments} +} + +\DeclareOption{revinfo}{ + \renewcommand{\revinfoheaderhook}{\revinfoheader} +} + +\DeclareOption{norevinfo}{ + \renewcommand{\revinfoheaderhook}{} +} + + +\DeclareOption{draft}{ + \ExecuteOptions{showcomments} + \ExecuteOptions{revinfo} +} + +\PassOptionsToPackage{automark}{scrpage2} +\PassOptionsToPackage{nodayofweek}{datetime} + +\PassOptionsToPackage{color,outerbars}{changebar} +\PassOptionsToPackage{normalem}{ulem} + + +% Defaults +\ExecuteOptions{} + + +% Process options of the package. +\ProcessOptions + + +% ----------------------------------------------------------------------- % +% Package Loading % +% ----------------------------------------------------------------------- % + + +\RequirePackage{ulem} % Underlining. +\RequirePackage{changebar} % Use change bars to highlight text ! +\RequirePackage{datetime} % Date formating issues + +\@ifclassloaded{beamer}{}{\RequirePackage{scrpage2}} + + + +% ----------------------------------------------------------------------- % +% Hooks % +% ----------------------------------------------------------------------- % + +\showkeyshook % and if there is no noshowkeys option. + % The package showkeys shows the keys of + % hyperrefs in draft mode. + +\visualdbghook % Visual debugging info + +\AtBeginDocument{\showkeyshackshook} + + + +% ----------------------------------------------------------------------- % +% Comments % +% ----------------------------------------------------------------------- % + +% TODO: catcode hack to show spaces? +% TODO: \endcmt should check if followed by \begincmt and replace +% them by a \newline! + +\def\begincmt{% + \begingroup% + \ifhmode\newline\else\fi% + \fontsize{9pt}{9pt}\ttfamily% + \chbar@begin{cmtcolor}% +} + +\long\def\hopone#1\fi{\fi#1} + +\def\endcmt@middle{\\[-0.6ex]} +\def\endcmt@ending{\chbar@end\endgroup} + +\long\def\endcmt#1#2{% + \ifx\begincmt #2% + \endcmt@middle% + \else% + \endcmt@ending% + \ifx\par #2\else \\ \fi + \hopone #2% + \fi% +} + + + +% ----------------------------------------------------------------------- % +% Handle active comments % +% ----------------------------------------------------------------------- % + +\ifluatex + \directlua{ + draftools = require("draftools") + luatexbase.add_to_callback("process_input_buffer", + draftools.parse_active_comments, + "Parse active comments", + 1) + } + + \newcommand{\showcomments}{% + \directlua{userdata.state.showcomments=true}% + } + + \newcommand{\hidecomments}{% + \directlua{userdata.state.showcomments=false}% + } + +\else + + \newcommand{\showcomments}{} + + \newcommand{\hidecomments}{} + +\fi + + + +% ----------------------------------------------------------------------- % +% Showkeys Hacks % +% ----------------------------------------------------------------------- % + +% Revert back the modifications on the \@@vpageref. I dont't want +% showkeys showing the keys for pagerefs. +\newcommand{\revertSKvpageref}{\def\@@vpageref{\SK@@@vpageref}} + + +% Solving a conflict with underbar, which is redefined in the package +% unicode-math. +\newcommand{\revertSKunderbar}{ +\def\SK@@ref##1>##2\SK@{% + {\@inlabelfalse\leavevmode\vbox to\z@{% + \vss + \SK@refcolor + \rlap{\vrule\raise .75em% + \hbox{\normalfont\footnotesize\ttfamily##2}}}}} +} + + +\def\abdoshowkeyslabel#1:#2:#3@{ + \fbox{\scriptsize\normalfont\ttfamily% + \ifx& + #1% + \else% + \renewcommand{\arraystretch}{0.6}% + \begin{tabular}{@{}c@{}}#1:\\#2\\[-0.2em]% + \end{tabular}% + \fi% + }% +} + +% This functions redefines the showkeys hook to typeset the label boxes. +\newcommand{\makeshowkeyshacks}{ + \renewcommand*{\showkeyslabelformat}[1]{\abdoshowkeyslabel##1::@} + \revertSKvpageref + \revertSKunderbar + \def\SK@labelcolor{\color{sklabelcolor}} + \def\SK@refcolor{\color{skrefcolor}} + +} + + + +% ----------------------------------------------------------------------- % +% Change Bar Stuff % +% ----------------------------------------------------------------------- % + +% Changebars configuration. +\setlength\changebarwidth{0.3em} +\setlength\changebarsep{5pt} +\cbcolor{gray} + +\newcounter{abdo@chbar@rec} +\setcounter{abdo@chbar@rec}{1} + +% Begins a changebar. Accepts a nonoptional color. +\newcommand{\chbar@begin}[1]{% + \addtocounter{abdo@chbar@rec}{1} + \colorlet{abdo@chbar@oldcolor@\alph{abdo@chbar@rec}}{.}% + \expandafter\global\expandafter\let% + \csname abdo@chbar@oldcbcolor@\alph{abdo@chbar@rec}\endcsname% + \cb@current@color% + \protect\cbstart% + \protect\cbcolor{#1}% + \protect\color{#1}% +} + +% Ends a changebar. +\newcommand{\chbar@end}{% + \protect\cbend% + \protect\color{abdo@chbar@oldcolor@\alph{abdo@chbar@rec}}% + \expandafter\global\expandafter\let\expandafter\cb@current@color% + \csname abdo@chbar@oldcbcolor@\alph{abdo@chbar@rec}\endcsname% + \addtocounter{abdo@chbar@rec}{-1} +} + + + +% ----------------------------------------------------------------------- % +% Revision History % +% ----------------------------------------------------------------------- % + +\ifluatex + % Set the revisions on a diff + \newcommand{\setdiffrevision}[2]{\directlua{draftools.set_diff_revinfo("#1", "#2")}} + + % Set revision info to the current revision + \newcommand{\setcurrentrevision}{\directlua{draftools.set_workingdir_revinfo()}} + + \setcurrentrevision +\fi + + +% Header line thickness +\newlength\rev@headerlinethickness +\setlength\rev@headerlinethickness{0.5pt} + + +% produce a revision info header +\newcommand{\revinfoheader}{ + \def\rev@header@cmd{% + \footnotesize\ttfamily% + \setlength\tabcolsep{0em}% + \begin{tabular*}{\textwidth}{p{10em}l@{\extracolsep{\fill}}r}% + \ifluatex% + \directlua{draftools.print_revinfo_header()}% + \fi% + \end{tabular*}% + \hfill% + } + + \defpagestyle{revinfo}{% + {\rev@header@cmd}{\rev@header@cmd}{\rev@header@cmd}% + }{% + {\pagemark\hfill}{\hfill\pagemark}{\hfill\pagemark\hfill}% + }% + + \pagestyle{revinfo}% + \setheadsepline{\rev@headerlinethickness}% +} + + + +% ----------------------------------------------------------------------- % +% Latexdiff Macros % +% ----------------------------------------------------------------------- % + +\newcommand{\cbmark}[1]{\begingroup\protect\cbcolor{diffbarcolor}% + \protect\cbstart\protect\color{diffbarcolor}#1\protect\cbend\endgroup} + +\newcommand{\uwmark}[1]{{\protect\color{diffaddcolor}\protect\uwave{#1}}} +\newcommand{\somark}[1]{{\protect\color{diffdelcolor}\protect\sout{#1}}} + +% Add and Del +\providecommand{\DIFadd}{} +%\providecommand{\DIFadd}[1]{\uwmark{#1}} +%\providecommand{\DIFdel}{}% +\providecommand{\DIFdel}[1]{\somark{#1}} + +% Hey ! There is an incompatibility between ulem's \sout and +% hyperref. When doing this inside a section, crashes because of the +% pdf metadata that hyperref produces. \texorpdfstring solves +% it, but this renders hyperref unusable with latexdiff. + +% \providecommand{\DIFdel}[1]{\somark{#1}} + +%Dif safe +\providecommand{\DIFaddbegin}{\chbar@begin{diffbarcolor}\protect\color{diffaddcolor}} +\providecommand{\DIFaddend}{\chbar@end} + +\providecommand{\DIFdelbegin}{} +\providecommand{\DIFdelend}{} + +%Dif floatsafe +%\providecommand{\DIFaddFL}[1]{\DIFadd{#1}} +%\providecommand{\DIFdelFL}[1]{\DIFdel{#1}} +\providecommand{\DIFaddFL}{} +\providecommand{\DIFdelFL}{} +\providecommand{\DIFaddbeginFL}{} +\providecommand{\DIFaddendFL}{} +\providecommand{\DIFdelbeginFL}{} +\providecommand{\DIFdelendFL}{} + + + +% ----------------------------------------------------------------------- % +% Run hooks % +% ----------------------------------------------------------------------- % + +\showcommentshook +\AtBeginDocument{\revinfoheaderhook} \ No newline at end of file diff --git a/make/cookiecutter-update.py b/make/cookiecutter-update.py new file mode 100755 index 0000000..d09769b --- /dev/null +++ b/make/cookiecutter-update.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2023, Sebastian Rust +# All rights reserved. +# +# This file is part of 'quic-message'. + + +import os +import sys +import json +import shutil +import subprocess +import json +from cookiecutter.main import cookiecutter + + +class TemporaryWorkdir(): + """Context Manager for a temporary working directory of a branch in a git repo""" + + def __init__(self, path, repo, branch='master'): + self.repo = repo + self.path = path + self.branch = branch + + def __enter__(self): + if not os.path.exists(os.path.join(self.repo, ".git")): + raise Exception("Not a git repository: %s" % self.repo) + + if os.path.exists(self.path): + raise Exception("Temporary directory already exists: %s" % self.path) + + os.makedirs(self.path) + subprocess.run(["git", "worktree", "add", "--no-checkout", self.path, self.branch], + cwd=self.repo) + + def __exit__(self, type, value, traceback): + shutil.rmtree(self.path) + subprocess.run(["git", "worktree", "prune"], cwd=self.repo) + + +def update_template(template_url, root, branch): + """Update template branch from a template url""" + tmpdir = os.path.join(root, ".git", "cookiecutter") + project_slug = os.path.basename(root) + config_file = os.path.join(root, ".cookiecutter.json") + tmp_workdir = os.path.join(tmpdir, project_slug) + + # read context from file. + context = None + if os.path.exists(config_file): + with open(config_file, 'r') as fd: + context = json.loads(fd.read()) + context['project_slug'] = project_slug + + # create a template branch if necessary + if subprocess.run(["git", "rev-parse", "-q", "--verify", branch], cwd=root).returncode != 0: + firstref = subprocess.run(["git", "rev-list", "--max-parents=0", "HEAD"], + cwd=root, + stdout=subprocess.PIPE, + universal_newlines=True).stdout.strip() + subprocess.run(["git", "branch", branch, firstref]) + + with TemporaryWorkdir(tmp_workdir, repo=root, branch=branch): + # update the template + cookiecutter(template_url, + no_input=(context != None), + extra_context=context, + overwrite_if_exists=True, + output_dir=tmpdir) + + # commit to template branch + subprocess.run(["git", "add", "-A", "."], cwd=tmp_workdir) + subprocess.run(["git", "commit", "-m", "Update template"], + cwd=tmp_workdir) + + +if __name__ == '__main__': + with open(sys.argv[1], 'r') as fd: + context = json.load(fd) + + update_template(context['_template'], os.getcwd(), branch=sys.argv[2]) + diff --git a/make/mkpreamble.py b/make/mkpreamble.py new file mode 100755 index 0000000..ccbcd14 --- /dev/null +++ b/make/mkpreamble.py @@ -0,0 +1,163 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2023, Sebastian Rust +# All rights reserved. + +import sys +import argparse +import json +import re + +import bibtexparser +from bibtexparser.bparser import BibTexParser +from bibtexparser.bwriter import BibTexWriter +from bibtexparser.customization import convert_to_unicode + + +def load_bibtex(f): + parser = BibTexParser() + parser.alt_dict = {} + + with open(f, 'r') as fd: + txt = re.sub('^\s*%.*$', '', fd.read(), flags=re.MULTILINE) + bib = bibtexparser.loads(txt, parser=parser) + + return bib.entries + + +def getstr(d, key, default=None): + val = d.get(key, None) + if val != None and len(val.strip()) > 0: return val.strip() + else: return default + + +def getlist(d, key, sep=',\s*'): + val = getstr(d, key) + if val: return [a.strip() for a in re.split(sep, val)] + else: return [] + + +def reindent(s, delta): + if delta >= 0: + return re.sub('^', delta * ' ', s, flags=re.MULTILINE) + else: + return re.sub('^' + (-delta) * ' ', '', s, flags=re.MULTILINE) + + +def format_entry(pattern, *values): + if all(values): + return pattern % values + + +def format_command(name, content): + if content: + if '\n' in content: return '\\%s{%%\n%s%%\n}' % (name, reindent(content, 2)) + else: return '\\%s{%s}' % (name, content) + + +def format_environment(name, content): + if content: + return '\\begin{%s}\n%s\n\\end{%s}' % (name, reindent(content, 2), name) + + +def format_title(metadata): + title = getstr(metadata, 'title', '') + thanks = getstr(metadata, 'thanks') + mrclass = getlist(metadata, 'mrclass') + # TODO: keywords? + + L = [title] + + if thanks: + L.append(r'\thanks{%s}' % thanks) + + if mrclass: + L.append(r'\unfootnote{\textbf{AMS CLassification:} %s.}' % (', '.join(mrclass))) + + return '%\n'.join(L) + + +def format_authors(authors): + L = [] + for a in authors: + name = getstr(a, 'name') + thanks = getstr(a, 'thanks') + if thanks: L.append(name + format_command('thanks', thanks)) + else: L.append(name) + return r' \and '.join(L) + + +def format_date(metadata): + date = getstr(metadata, 'date') + if date: + y, m, d = date.split('-') + return r'\formatdate{%s}{%s}{%s}' % (d.strip(), m.strip(), y.strip()) + + +def format_abstract(metadata): + abstract = getstr(metadata, 'abstract') + return format_environment("abstract", abstract) + + +def format_authorlist(authors): + L = [] + for a in authors: + L.append(r' \vspace{1em}') + L.append(r' \parbox[t]{0.5\textwidth}{') + L.append(format_entry(r' \textbf{%s}\\', a.get('name',None))) + L.append(format_entry(r' \texttt{%s}\\', a.get('email',None))) + L.append(format_entry(r' \texttt{\url{%s}}\\', a.get('url',None))) + L.append(r' \\') + L.append(format_entry(r' %s\\', a.get('university',None))) + L.append(format_entry(r' %s\\', a.get('department',None))) + L.append(format_entry(r' %s\\', a.get('address',None))) + L.append(format_entry(r' %s\\', a.get('city',None))) + L.append(' }') + + return '%\n'.join([it for it in L if it != None]) + + +def format_preamble(metadata, authors): + L = [] + L.append('% Auto-generated preamble') + + L.append(format_command('title', format_title(metadata))) + L.append(format_command('author', format_authors(authors))) + L.append(format_command('date', format_date(metadata))) + + # add institute entry for beamer slides + if metadata['entrysubtype'] == 'slides': + for a in authors: + if a['name'] in metadata['author']: + L.append(format_command('institute', a['university'])) + + L.append(format_command(r'newcommand{\makeabstract}', format_abstract(metadata))) + L.append(format_command(r'newcommand{\makeauthorlist}', format_authorlist(authors))) + + return '\n\n'.join([it for it in L if it != None]) + + +# ----------------------------------------------------------------------- # +# Argument parsing # +# ----------------------------------------------------------------------- # + +parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, + description='Generate preamble') + +parser.add_argument("metadata", help="Metadata file",) + +args = parser.parse_args() + +entries = load_bibtex(args.metadata) +metadata = None +authors = [] + +for e in entries: + if e['ENTRYTYPE'] == 'article': + metadata = e + + elif e['ENTRYTYPE'] == 'misc': + authors.append(e) + +print(format_preamble(metadata, authors)) diff --git a/metadata.bib b/metadata.bib new file mode 100644 index 0000000..3397ea0 --- /dev/null +++ b/metadata.bib @@ -0,0 +1,52 @@ +@article{roi:quic-message, +% Basic document metadata. + author = {Sebastian Rust}, + title = {The Title}, + language = {english}, + date = {2023-03-08}, + +% Journal metadata + journal = {}, + volume = {}, + number = {}, + pages = {}, + issn = {}, + +% On-line metadata + doi = {}, + eprint = {}, + eprinttype = {arxiv}, + eprintclass = {}, + mrnumber = {}, + mrclass = {}, + url = {}, + +% Abstract and thanks + abstract = {The Abstract.}, + thanks = {}, + +% Journal statistics + jcrrank = {}, + jcrsubject = {}, + jcrimpact = {}, + +% Personal classification +entrysubtype = {paper}, + keywords = {private}, + pubstate = {inpreparation}, +} + +% Authors +@misc{author:roi, + name = {Sebastian Rust}, + email = {harlequix@gmail.com}, + url = {https://kom.tu-darmstadt.de}, + + university = {University of Warsaw}, + department = {Institute of Mathematics}, + address = {ul. Banacha, 2}, + city = {02-097 Warszawa}, + + thanks = {}, +} + diff --git a/quic-message.bib b/quic-message.bib new file mode 100644 index 0000000..d0ba984 --- /dev/null +++ b/quic-message.bib @@ -0,0 +1,11 @@ +@article {wit:ell.gen, + author = {Witten, Edward}, + title = {Elliptic genera and quantum field theory}, + journal = {Communications in Mathematical Physics}, + volume = {109}, + year = {1987}, + number = {4}, + pages = {525--536}, + mrnumber = {MR0885560}, + doi = {10.1007/BF01208956}, +} diff --git a/quic-message.tex b/quic-message.tex new file mode 100644 index 0000000..d9a4e30 --- /dev/null +++ b/quic-message.tex @@ -0,0 +1,35 @@ +\documentclass[a4paper,11pt,english,draft,lightcolors]{scrartcl} + +\usepackage{abdokoma} +\geometry{left=3cm, right=3cm, top=4cm, bottom=3cm} +\KOMAoptions{parskip=half+} + +\input{preamble.tex} +\addbibresource{quic-message.bib} + + +% ------------------------------------ % +% The Thing % +% ------------------------------------ % + +\begin{document} + +\maketitle +\makeabstract +\tableofcontents + +% Blah, blah. + +% Bibliography +\nocite{*} +\printbibliography + +% Author list +\makeauthorlist + +\end{document} + +%%% Local variables: +%%% ispell-local-dictionary: "english" +%%% TeX-master: t +%%% End: