tame/design/tpl/tpl.sty

208 lines
5.3 KiB
TeX
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

% The TAME Programming Language LaTeX style and macros
%
% Copyright (C) 2021 Ryan Specialty Group, LLC.
%
% Licensed under the Creative Commons Attribution-ShareAlike 4.0
% International License.
%%
%%
% Package Imports
%%
\usepackage[letterpaper]{geometry} % US Letter paper
\usepackage[amsfonts,amssymb]{concmath} % Fonts used by the text
\usepackage{euler} % Concrete Mathematics
\usepackage{makeidx} % Indexing
\usepackage[colorlinks=true,
linkcolor=href,
draft=false]{hyperref} % Hyperlinks (even in draft mode)
\usepackage{xcolor} % Colors (for hyperlinks)
\usepackage[final]{listings} % Displaying code (even in draft)
\usepackage{amsmath,amsthm} % AMS macros, including theorems
\usepackage{suffix} % To aid in defining star macros
\usepackage{marginnote} % Notes in the margin
\usepackage{ccicons} % CC license icons
\usepackage{manfnt} % Dangerous Bend symbols
%%
% Colors
%
% Colors from Tango Icon Theme
% https://en.wikipedia.org/wiki/Tango_Desktop_Project
\definecolor{href}{HTML}{204a87}
%%
% Listing language
%%
\lstset{
language=XML,
basicstyle=\ttfamily,
columns=fullflexible,
keepspaces=true,
showstringspaces=false,
}
%%
% Common typesetting
%%
% TAME
\newcommand\tame{\textsc{Tame}}
\newcommand\tamer{\textsc{Tamer}}
\newcommand\tameparam[1]{\texttt{#1}}
\newcommand\tameclass[1]{\texttt{#1}}
\newcommand\tameconst[1]{\texttt{#1}}
\newcommand\tametrue{\tameconst{TRUE}}
\newcommand\tamefalse{\tameconst{FALSE}}
\let\tamepkg\texttt
% XML
\let\xml\texttt
\newcommand\xmlnl{\\[-3mm]}
\newcommand\xpath[1]{\texttt{#1}}
\newcommand\xmlnode[1]{\texttt{#1}}
\newcommand\xmlattr[1]{{@\texttt{#1}}}
%%
% Mathematics
%%
% Boolean
\newcommand\true{\ensuremath\top}
\newcommand\false{\ensuremath\bot}
\newcommand\Bool{\ensuremath{\mathbb{B}}}
% Numbers
\newcommand\Int{\ensuremath{\mathbb{Z}}}
\newcommand\Real{\ensuremath{\mathbb{R}}}
% Sets and families
\newcommand\Set[1]{\ensuremath{\left\{#1\right\}}}
\newcommand\Fam[3]{\ensuremath{\left\{#1_{#2}\right\}_{#2\in #3}}}
\newcommand\len[1]{\ensuremath{\left|#1\right|}}
\let\union\cup
\let\Union\bigcup
\let\intersect\cap
% Vectors and matrices with family notations
\newcommand\Vectors{\ensuremath{\mathcal{V}}}
\newcommand\Vector[1]{\ensuremath{\left\langle#1\right\rangle}}
\newcommand\VFam[3]{\ensuremath{\Vector{#1_{#2}}_{#2\in #3}}}
\newcommand\Matrices{\ensuremath{\Vectors^{\Vectors^\Real}}}
\newcommand\MFam[5]{\ensuremath{%
\Vector{{#1_{#2}}_#4}_{\underset{#4\in {#5_#2}}{#2\in #3}}
}}
% Logic
\let\infer\vdash
\newcommand\Forall{\@ifstar\@Forallstar\@Forall}
\newcommand\@Forall[2]{\forall #1\left(#2\right)}
\newcommand\@Forallstar[2]{\forall #1 #2}
\newcommand\Exists{\@ifstar\@Existsstar\@Exists}
\newcommand\@Exists[2]{\exists #1\left(#2\right)}
\newcommand\@Existsstar[2]{\exists #1 #2}
% Group theory
\newcommand\Monoid[3]{\left({#1},{#2},{#3}\right)}
% Binary function composition
\newcommand\bicomp[1]{{#1}^\circ}
% Grammar
\let\emptystr\epsilon
% TAME Classification
\DeclareMathOperator*\Classify{%
\mathchoice{\vcenter{\hbox{\huge$\mathfrak{C}$}}}
{\vcenter{\hbox{\Large$\mathfrak{C}$}}}
{\frak{C}}
{\frak{C}}
}
%%
% Theorem environments
%%
\numberwithin{equation}{section} % number by section
% Create a new theorem environment along with a set of label/ref/pref
% commands.
\newcommand\newtheoremwithlabel[3]{%
\newtheorem{#1}{#2}[section]
\expandafter\def\csname #1autorefname\endcsname{#2}
\expandafter\newcommand\csname #3label\endcsname[1]{\label{#1:##1}}
\expandafter\newcommand\csname #3ref\endcsname[1]{\autoref{#1:##1}}
\expandafter\newcommand\csname #3pref\endcsname[1]{\autopref{#1:##1}}
}
\theoremstyle{definition}
\newtheoremwithlabel{definition}{Definition}{dfn}
\newtheoremwithlabel{axiom}{Axiom}{axm}
\theoremstyle{plain}
\newtheoremwithlabel{corollary}{Corollary}{cor}
\newtheoremwithlabel{lemma}{Lemma}{lem}
\newtheoremwithlabel{theorem}{Theorem}{thm}
\theoremstyle{remark}
\newtheoremwithlabel{remark}{Remark}{rem}
%%
% General typesetting
%%
\newcommand\pref[1]{\ref{#1} on page~\pageref{#1}}
\newcommand\seclabel[1]{\label{sec:#1}}
\newcommand\secref[1]{Section~\ref{sec:#1}}
\newcommand\secpref[1]{Section~\pref{sec:#1}}
% Definitions (introduction of terms)
\let\dfn\textsl
\newcommand\todo[1]{%
\marginnote{\underline{\textsc{Todo:}}\\
\textsl{#1}}%
}
\newcommand\mremark[1]{\marginnote{\textsl{#1}}}
% A really obnoxious notice making clear to the reader that this portion of
% the work is unfinished, to the point where it's probably even
% incorrect. Uses dangerous bend symbol from manfnt, which is admittedly a
% misuse given that it's often used to represent difficult problems. Though
% I suppose an unfinished work is a difficult problem.
\newcommand\INCOMPLETE[1]{%
\bigskip
\par
\todo{This is incomplete!}
\hfill\textdbend\textbf{\textsl{#1}}\textdbend\hfill
\bigskip
}
%%
% Indexing
%%
% Symbols appear at the beginning of the index
\newcommand\indexsym[2]{\index{__sym_#2@{\ensuremath{#1}}|see {#2}}}
%%
% Dynamic Configuration
%%
\newif\iftplappendix
\InputIfFileExists{./conf.tex}%
{\message{Loaded `./conf.tex'.}}%
{\message{`./conf.tex' not found (did you run `./configure'?).
Using defaults.}%
}