Files
l3-ocr-slides/packages/lab-common.sty
2026-11-09 11:32:54 +00:00

64 lines
2.4 KiB
TeX

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{packages/lab-common}[2026/11/02 Macros shared by all templates]
% This file is byte-identical in every template. Edit one copy in the template
% repository, then copy it to the others (see the root README.md).
%
% Load order: after babel, and after minted where minted is used. Load xcolor
% with its options before this package, or pass them with \PassOptionsToPackage.
% engine: every template compiles with LuaLaTeX
\ExplSyntaxOn
\msg_new:nnn { lab-common } { require-luatex }
{ This~template~requires~LuaLaTeX.~Set~the~compiler~to~LuaLaTeX~
(on~Overleaf:~Menu,~then~Compiler). }
\sys_if_engine_luatex:F { \msg_fatal:nn { lab-common } { require-luatex } }
\ExplSyntaxOff
% quotes
\RequirePackage[autostyle]{csquotes}
\MakeOuterQuote{"}
% colours, from the cmyk values in dvipsnam.def, so that the macros below work
% whichever options xcolor was loaded with
\RequirePackage{xcolor}
\definecolor{labDone}{cmyk}{0.50,0,1,0} % LimeGreen
\definecolor{labTodo}{cmyk}{0,0.10,0.84,0} % Goldenrod
\definecolor{labFixme}{cmyk}{0,1,1,0} % Red
\definecolor{labYes}{cmyk}{0.44,0,0.74,0} % YellowGreen
\definecolor{labNo}{cmyk}{0,0.89,0.94,0.28}% BrickRed
\definecolor{labMaybe}{cmyk}{0,0.61,0.87,0}% Orange
% circles
\RequirePackage{circledsteps}
\pgfkeys{/csteps/inner color=white}
\pgfkeys{/csteps/fill color=black}
% markers
\RequirePackage{pifont}
\newcommand{\cmark}{{\color{labYes}\ding{51}}}
\newcommand{\xmark}{{\color{labNo}\ding{55}}}
\newcommand{\imark}{{\color{labMaybe}\ding{109}}}
% status pills: \TODO, \TODO{text}, likewise \FIXME and \DONE
\RequirePackage{xparse} % for the optional {text} argument
\RequirePackage{xspace}
\NewDocumentCommand{\pill}{m m m g}{%
\CircledParamOpts{inner color=#1, outer color=#2, fill color=#2}{1}{%
\textbf{#3}\IfValueT{#4}{ \textbf{--} #4}%
}%
\IfNoValueT{#4}{\xspace}% keep the space in "\TODO bla"
}
\newcommand{\DONE}{\pill{black}{labDone}{DONE}}
\newcommand{\TODO}{\pill{black}{labTodo}{TODO}}
\newcommand{\FIXME}{\pill{white}{labFixme}{FIXME}}
% table columns: L{width}, C{width} and R{width} wrap text, F fills the line
\RequirePackage{array}
\newcolumntype{F}{>{\arraybackslash}m{\linewidth}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}}
\endinput