% \iffalse meta-comment % %% File: propositions.dtx %% %% Copyright (C) 2026 Cian Dorr %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% %% https://www.latex-project.org/lppl.txt %% %% and version 1.3c or later is part of all distributions of LaTeX %% version 2008 or later. %% %% This work has the LPPL maintenance status `maintained'. %% %% The Current Maintainer of this work is Cian Dorr. %% %% This work consists of the files propositions.dtx and propositions.ins %% and the derived files propositions.sty and propositions.pdf. %% % \fi % % \iffalse %<*driver> \documentclass[leqno]{ltxdoc} \usepackage[T1]{fontenc} \usepackage{amsmath} \usepackage[most]{tcolorbox} \tcbuselibrary{documentation} \usepackage[equations]{propositions} \usepackage{cleveref} \usepackage{fancyvrb} \VerbatimFootnotes \hypersetup{colorlinks,linkcolor=blue!60!black,urlcolor=blue!60!black} %% Live examples: the code above, its result below, in a two-tone tcolorbox. %% The body is written out verbatim and then used twice --- listed with %% gobble=2, which strips the "% " that every documentation line carries, and %% \input to produce the result (there % is still catcode 9, so it needs no %% stripping). fancyvrb does the listing rather than tcolorbox's own %% \dispExample because listings' gobble is silently ignored by %% \lstinputlisting, which is what \dispExample uses. \newenvironment{example} {\VerbatimEnvironment \begin{VerbatimOut}{\jobname-ex.tex}} {\end{VerbatimOut}% \begin{tcolorbox}[propexample] \VerbatimInput[gobble=2]{\jobname-ex.tex}% \tcblower \input{\jobname-ex.tex}% \end{tcolorbox}} %% Code-only display (no execution): the same box without a lower part. \newenvironment{codebox} {\VerbatimEnvironment \begin{VerbatimOut}{\jobname-cb.tex}} {\end{VerbatimOut}% \begin{tcolorbox}[propexample] \VerbatimInput[gobble=2]{\jobname-cb.tex}% \end{tcolorbox}} \tcbset{ color command=red!60!black, color key=green!50!black, %% ExampleFrame/ExampleBack are tcolorbox's own documentation colours. propexample/.style={ enhanced, breakable, colframe=ExampleFrame, colback=ExampleBack, skin=bicolor, colbacklower=white, arc=1pt, boxrule=0.6pt, left=1em, right=1em, top=0.5em, bottom=0.5em, before skip=\medskipamount, after skip=\medskipamount, fontupper=\small, fontlower=\small, }, docexample/.style={ colframe=blue!50!black, colback=blue!3!white, before skip=\medskipamount, after skip=\medskipamount, fontlower=\small, }, } \EnableCrossrefs \CodelineIndex \OnlyDescription \begin{document} \DocInput{\jobname.dtx} \end{document} % % \fi % % \GetFileInfo{propositions.sty} % % \title{The \textsf{propositions} package} % \author{Cian Dorr\\ \texttt{ciandorr@gmail.com}} % \date{\fileversion: \filedate} % % \maketitle % % \begin{abstract} % \noindent The \textsf{propositions} package provides a key-value driven system % for labelling propositions, theses, and premises in academic papers. % Items may be given names like `(P)' or % `Physicalism', or auto-numbered using different counters; all carry robust % cross-references with configurable formatting. % The package integrates with \textsf{amsmath}, \textsf{hyperref}, \textsf{cleveref}, and \textsf{zref-clever}. % \end{abstract} % % \tableofcontents % % \section{Introduction} % % In some academic disciplines (such as philosophy), it is common to have displayed propositions (examples, theses, premises,\ldots) with various kinds of labels. A thesis might be referred to as `(P)' or `Physicalism'; the premises of an argument might be numbered as `P1', `P2', `P3', \ldots; or examples might be numbered consecutively over the course of a whole article. % Standard \LaTeX{} environments like |enumerate| can % handle some of these cases, but cross-referencing is awkward: % |\ref| produces a bare number or letter, and the author must manually % add parentheses or other formatting at every point of reference. The standard |description| environment, meanwhile, does not allow cross-referencing at all. % % The \textsf{propositions} package solves this by attaching formatting % information to each label. With an appropriate choice of style, |\item[P]| (inside \refEnv{prop}) is displayed % as ``(P)'' and |\ref| automatically produces ``(P)'' as well---complete % with parentheses and hyperlink. The full % key-value interface supports named items, numbered items, custom % counters, glosses, shorthands, per-item format changes, changes to the list geometry, and styles. % % The \refCom{ptag} command (which requires \textsf{amsmath}) extends this to % displayed math environments: an equation can be tagged with a % proposition label instead of (or using) its equation number, and |\ref| to an equation will pick up its % name or number with specified formatting. % % \section{History} % I wrote the ancestor to this package in the 90s % while finishing my Ph.D. thesis, and used it in my own work but never documented or shared it. This new % version is a thorough re-implementation in \LaTeX3, % written in 2026 with very extensive help from Claude Code. I % hope others will find it as useful as I have. % % \section{Basic usage} % Load with |\usepackage{propositions}| (see \autoref{sect:keys-global} below for valid package options). % % The |prop| environment generates a list of propositions, each introduced by |\item|. |\item| with an optional argument gives a |description|-like label: % \begin{example} % \begin{prop} % \item[Physicalism] Everything is physical. \label{phys} % \item[Idealism] Everything is mental. \label{ideal} % \end{prop} % \end{example} % Unlike the standard |description| environment, one can refer back to these propositions using the standard |\ref| command (or with new cross-referencing commands described in \cref{sect:xref}): % \begin{example} % \ref{phys} is more plausible than \ref{ideal}. % \end{example} % With no optional argument, |\item| will by default generate numbered items similar to |enumerate|, but with numbering that persists across the document: % \begin{example} % \begin{prop} % \item Every atom is physical. \label{atoms} % \end{prop} % \ref{phys} follows from the conjunction of \ref{atoms} and % \begin{prop} % \item Everything is an atom. \label{atomism} % \end{prop} % \end{example} % As with |enumerate|, the % counter and formatting depend on the % nesting level: % \begin{example} % \begin{prop} % \item \label{dual} % \begin{prop} % \item Some things are physical. \label{some} % \item Some things are not physical. \label{notall} % \end{prop} % \end{prop} % Without \ref{some}, \ref{dual} would be consistent % with \ref{ideal}. % \end{example} % % \section{Advanced usage} % The format of the proposition labels, and of % subsequent references, are both configurable using a key=value syntax (see \autoref{sect:keys} for the possible keys): % \begin{example} % \begin{prop} % \item[No Overlap, % align=flush, % display format=\textsc{#1}, % ref format=\textit{#1}] % Nothing mental is physical. \label{incomp} % \end{prop} % Is \ref{incomp} consistent with \ref{phys}? % \end{example} % The prop environment can also take an optional argument with a list of keys: % \begin{example} % \begin{prop}[leftmargin=5em, format=[#1]] % \item Every mental thing is physical. % \end{prop} % \end{example} % Preset styles can be declared and used in place of a set of key-value pairs. The package loads with a range of predefined styles (see \cref{sect:builtin-styles}). % \begin{example} % \begin{prop} % \item[Nihilism, style=thesis] There is nothing. \label{nihilism} % \end{prop} % Does \ref{nihilism} imply \ref{phys}, \ref{dual}, or both? Discuss. % \end{example} % % Additional cross-referencing commands (see \cref{sect:xref}) include \refCom{nref} (strips formatting from reference) and \refCom{lastref} (refers to the most recent proposition, even if it lacked a label): % \begin{example} % \begin{prop} % \item[Mentality] \label{mental} Everything is mental. % \item[\nref{mental}*] Many things are mental. % \end{prop} % One may think \lastref\ more reasonable than \ref{mental}. % \end{example} % % When the package is loaded with |\usepackage[equations]{propositions}|, a first-level |\item| within \refEnv{prop} % will use the counter as equations. (This looks better % with the |leqno| option to |\documentclass|.) % \begin{example} % \begin{equation} % \exists x (\text{Mental}(x) \wedge \text{Physical}(x)) \label{overlap} % \end{equation} % \ref{overlap} can be stated in English as \ref{overlap2}: % \begin{prop} % \item Some things are both mental and physical. \label{overlap2} % \end{prop} % \end{example} % The \refCom{ptag} command (requires \textsf{amsmath}) % is a replacement for the standard |\tag| command % that behaves just like an |\item| in a \refEnv{prop} % environment. % \begin{example} % \begin{equation} % \ptag[Monism, \format=\textsc{#1}] \label{mon} % \exists x \forall y(y = x) % \end{equation} % Is \ref{mon} compatible with \ref{dual}? % \end{example} % % \section{Basic environments and commands} % % \begin{docEnvironment}{prop}{\oarg{keys}} % Creates a displayed list of propositions. It is a standard \LaTeX{} list, so by default its formatting will depend on the standard length parameters like \cs{itemsep} and \cs{topsep}, although these can be overridden by setting keys. % % Within \refEnv{prop}, \cs{item} creates the propositions (see below). % % The optional \meta{keys} argument can contain a list of keys, which will affect only the given environment (not any other \refEnv{prop} environments that may be nested within it). % % \end{docEnvironment} % % \begin{docEnvironment}{inlineprop}{\oarg{keys}} % Like \refEnv{prop}, but does not create a list. Allows \cs{item} to be used outside list environments, e.g.\ for generating numbers at the beginning of paragraphs. Steps the \texttt{prop} counter and increments the nesting level. Accepts the same optional \meta{keys} as \refEnv{prop}. % \end{docEnvironment} % % Within \refEnv{prop} and \refEnv{inlineprop}, \cs{item} is redefined to act as the proposition-item command. Its optional argument is a comma-separated list of \meta{key}=\meta{value} pairs (see \autoref{sect:keys}). A bare string without \texttt{=} is treated as a proposition name. % % When used without an optional argument (or without setting \refKey{name}, \refKey{counter}, or \refKey{style}), the style is determined by the \refKey{nameless style} key (\autoref{sect:keys}). By default this is \texttt{numbered}, which dispatches by nesting depth to \texttt{levelone}, \texttt{leveltwo}, \ldots\ via \refCom{proplevelchoice}. % % \begin{docCommand}{ptag}{\oarg{keys}} % (Available only when \textsf{amsmath} is loaded.) Works inside displayed math environments like \texttt{equation} and \texttt{align}. Accepts the same keys as \cs{item} within \refEnv{prop}, except that \refKey{align} has no effect (since positioning is controlled by the tag placement system). % % Any display math environment (|equation|, |align|, etc.) used inside \refEnv{prop} or \refEnv{inlineprop} automatically increments the nesting level for its duration, so that \cs{ptag} inside such an environment behaves as if it were one level deeper. % \end{docCommand} % % \begin{docCommand}{propoptions}{\marg{keys}} % Sets default keys (see \autoref{sect:keys}), which take effect for all subsequent uses of \refEnv{prop}, \refEnv{inlineprop}, |\item|, and \refCom{ptag} (within the current scope). % \end{docCommand} % % \begin{docCommand}{proplevelchoice}{\marg{item1, item2, \ldots}} % Picks the entry from the comma-separated list depending on the current nesting depth (1-indexed; last element will be used if the list is too short; empty entries are skipped). At depth~0 (outside any \refEnv{prop} environment), returns the first entry. % % This macro can be used, for example, to set different list dimensions for different nesting levels (see \cref{sect:keys-dims}) or to create styles that produce different results depending on the nesting depth where they are used (see \cref{sect:styles}). % \end{docCommand} % % \begin{docCommand}{propfootnotechoice}{\marg{outside}\marg{inside}} % Expands to \meta{inside} within the text of a footnote, and to \meta{outside} anywhere else. The built-in \texttt{numbered} and \texttt{eqnum} styles use it to select \texttt{footnumprop} in footnotes (see \cref{sect:styles}). % \end{docCommand} % % % Further commands are described below, especially in \cref{sect:xref} (cross-referencing) and \cref{sect:styles} (defining styles). % % \section{Keys}\label{sect:keys} % % \subsection{Item-level keys}\label{sect:keys-item} % % The keys listed in this subsection can be used in the following places: % \begin{itemize} % \item % In the optional argument of |\item| or \refCom{ptag}: the key applies to that item only. % \item In the optional argument of \refEnv{prop} or \refEnv{inlineprop}: the key applies to every top-level |\item| within % that environment, unless overridden by the |\item|'s own optional argument. (If another \refEnv{prop} or \refEnv{inlineprop} environment is used inside this one, the key will % not apply to its |\item|s.) % \item In the argument of \refCom{propoptions}: the key % will apply to every subsequent |\item| or \refCom{ptag} (in the current group), unless overridden by that |\item|'s optional argument, or that % of its parent environment. % \item In the optional argument of |\usepackage{propositions}|: equivalent to \refCom{propoptions}, except that keys that require the |#| character cannot be set here, (due to a limitation in how \LaTeX\ processes options) % \item With \refCom{SetPropStyle} or \refCom{DeclareNumberedStyle}, to % add the key to a given style. % \end{itemize} % % \begin{docKey}{style}{=\meta{style}}{no default} % A style, equivalent to a preset collection of keys: see \cref{sect:styles} for details. % \end{docKey} % % \begin{docKey}{name}{=\meta{text}}{no default} % The proposition's name. A bare string (without \texttt{=}) is equivalent to \texttt{name=}\meta{text}. (To be precise: if the optional argument contains no \texttt{=} at all, the whole of it is the name; otherwise, it is read as a key list, and any entry of it without an \texttt{=} is the name, so a bare name can be combined with other keys, as in |\item[No Overlap, align=flush]|. In that case a name containing a comma must be braced---|\item[{Alpha, Beta}, align=flush]|---and a name containing an \texttt{=} needs the explicit \texttt{name=}|{|\meta{text}|}| form.) % \end{docKey} % % \begin{docKey}{counter}{=\meta{name}}{no default} % Counter to use. The counter is automatically stepped, and the item's \refKey{name} is set to \cs{the}\meta{name} (though this can be overridden by \refKey{counter format} or \refKey{name}). % % Any counter can be used with \refKey{counter format}. Special counters \docCounter{numpropii}, \docCounter{numpropiii}, \docCounter{numpropiv}, \docCounter{numpropv} are provided, whose values are automatically reset each time an |\item| is processed at a lower nesting level. There is also a counter \docCounter{numpropi} which never automatically resets, and a counter \docCounter{enumprop} which is reset at every \emph{outermost} \refEnv{prop} or \refEnv{inlineprop} environment, so that lists using this counter behave like the standard \texttt{enumerate} environment. Finally, there is a counter \docCounter{footprop}, reset at the beginning of every footnote, used by the \texttt{footnumprop} style (see \cref{sect:styles}). % % The special value \texttt{counter\,=\,none} unsets the \refKey{counter} key (potentially useful if it would otherwise have been set by a style). % \end{docKey} % % \begin{docKey}{counter format}{=\meta{template}}{no default} % How to display the counter value. Use \texttt{\#1} for the counter name, e.g.\ \texttt{counter format=\string\roman\{\#1\}}. When both this key and \refKey{counter} are set, this is used instead of \cs{the}\meta{counter} for generating the item's \refKey{name}. % \end{docKey} % \noindent Along with the standard commands (\cs{arabic}, \cs{roman}, \cs{Roman}, \cs{alph}, \cs{Alph}, and \cs{fnsymbol}), the following command is available: % % % \begin{docCommand}{proprepeat}{\marg{counter}\marg{token}} % Prints \meta{token} as many times as the value of \meta{counter}. % \end{docCommand} % % \begin{example} % \begin{prop}[counter = enumprop, format = (#1), % counter format = \proprepeat{#1}{*}] % \item An item labelled with one asterisk. % \item And another, labelled with two. % \end{prop} % \end{example} % % \begin{docKey}{display format}{=\meta{template}}{no default} % Format for displaying the name or counter value in the proposition's label. Use \texttt{\#1} for the argument, e.g.\ \texttt{display format=\string\textbf\{\#1\}}. Does not affect cross-references. % \end{docKey} % % \begin{docKey}{ref format}{=\meta{template}}{no default} % Format for subsequent cross-references to this proposition. Use \texttt{\#1} for the argument, e.g.\ \texttt{ref format=\string\{(\#1)\}}. Does not affect the display. % \end{docKey} % % % \begin{docKey}{format}{=\meta{template}}{no default} % Shorthand for setting both \refKey{display format} and \refKey{ref format}. % \end{docKey} % % \begin{docKey}{shorthand}{=\meta{text}}{no default} % An abbreviation displayed after the name. If present, the shorthand becomes the reference text: \cs{ref} produces the shorthand (formatted with \refKey{ref format}) rather than the full name. % \end{docKey} % % \begin{example} % \begin{prop} % \item[Global Physical Supervenience, shorthand=GPS] \label{global} % Every fact is entailed by some fact about % the physical world. % \end{prop} % There are several interesting arguments for \ref{global}. % \end{example} % % \begin{docKey}{shorthand format}{=\meta{template}}{initially \texttt{\string~[\#1]}} % Format for displaying the shorthand in the label. % \end{docKey} % % \begin{docKey}{gloss}{=\meta{text}}{no default} % A parenthetical gloss displayed after the name. Does not affect cross-references. % \end{docKey} % % \begin{example} % \begin{prop} % \item[Humean Supervenience, gloss=after David Lewis] % Every fact is entailed by some fact about the % fundamental properties and spatiotemporal relations % of points. % \end{prop} % \end{example} % % \begin{docKey}{gloss format}{=\meta{template}}{initially \texttt{\string~(\#1)}} % Format for displaying the gloss in the label. % \end{docKey} % % \begin{docKey}{label format}{=\meta{template}}{no default} % Format applied to the \emph{entire} assembled label, i.e.\ the name (after % \refKey{display format}), shorthand, and gloss together. Use \texttt{\#1} for % the whole assembled text. For example, \texttt{label format=\#1:}\ appends % a colon after the complete label. % \end{docKey} % % \begin{docKey}{ref}{=\meta{text}}{no default} % Explicitly set the reference text, overriding what would be derived from \refKey{name}, \refKey{counter}, or \refKey{shorthand}. % \end{docKey} % % \begin{docKey}{label}{=\meta{label}}{no default} % Equivalent to a trailing \cs{label}\marg{label}. % \end{docKey} % % \begin{docKey}{reset}{=\meta{boolean}}{initially \texttt{true}} % When \texttt{true} (the default), processing an \cs{item} resets the % sub-level counter one nesting depth below the current level % (e.g.\ \texttt{numpropii} at level~1). \texttt{reset=false} suppresses this behaviour, so that sub-item numbering continues from where it % left off across consecutive parent items. % % An item that continues a run in this way does not become the parent of the sub-list that follows it: the run belongs, for referring purposes, to whatever item it began under. Taking each intervening item as the parent instead would give a run reading \texttt{1a}, \texttt{1b}, \texttt{2c}, \texttt{2d}, whose letters answer to one parent and whose prefixes to another. This is what lets an aside between two sub-lists---the \texttt{nolabel} style of \cref{sect:builtin-styles}---interrupt a run of clauses without breaking it. An unlabelled item that should start a fresh sub-list instead wants \texttt{[style\,=\,nolabel, reset\,=\,true]}; its sub-items then refer with no prefix, having no parent reference to inherit. % \end{docKey} % % \begin{docKey}{crefname}{=\meta{type}}{no default} % When \textsf{cleveref} or \textsf{zref-clever} is loaded, assigns an arbitrary reference type to this proposition. For example, \texttt{crefname=lemma} on an item for which |\ref| would produce ‘(17)’ causes \cs{cref} (\textsf{cleveref}) or \cs{zcref} (\textsf{zref-clever}) to produce ‘lemma (17)’, and \cs{Cref} or \cs{zcref}\texttt{[cap]} to produce ‘Lemma (17)’. The \meta{type} must be known to the package in use; new types can be declared with \cs{crefname} (with \textsf{cleveref}) or \cs{zcRefTypeSetup} (with \textsf{zref-clever}). (Bear in mind that a type carrying a format of its own will apply it to the reference this package has already formatted: \texttt{crefname=equation} turns ‘(17)’ into ‘eq.\ ((17))’, since both packages parenthesise references of that type.) % \end{docKey} % % Four of the list-dimension keys documented in the next section---\refKey{labelwidth}, \refKey{labelsep}, \refKey{itemindent} and \refKey{labelindent}---may also be given to an individual \cs{item}, where they reposition the label of that item alone, overriding the value in force for the rest of the list. (The other dimension keys have no effect at item level.) % % \subsection{Keys for changing the list geometry}\label{sect:keys-dims} % % The keys in this section can be used in the following places: % \begin{itemize} % \item In the optional argument of \refEnv{prop}: the key applies to that environment only, not to any other \refEnv{prop} or \refEnv{inlineprop} environments that may be nested within it. % \item In the argument of \refCom{propoptions}: the key % will apply to every subsequent \refEnv{prop} environment (in the current group), unless overridden by that environment's optional argument. % \item In the optional argument of |\usepackage{propositions}|: equivalent to \refCom{propoptions}. % \item With \refCom{SetPropStyle} or \refCom{DeclareNumberedStyle}, to % add the key to a given style. % \end{itemize} % Five of the keys can also be used in the optional argument of |\item| to affect the geometry of that specific proposition (\refKey{align}, \refKey{labelwidth}, \refKey{labelsep}, \refKey{itemindent}, and \refKey{labelindent}). The other keys will have no effect in an |\item| (or a \refCom{ptag}). % % \begin{docKey}{align}{\docKeyChoices{left,right,center,flush,runin,nextline,flush-nextline}}{initially \docValue{left}} % How the label should be positioned. % \docValue{left} is the standard left-aligned label, its offset controlled by \refKey{labelwidth} and \refKey{labelsep}; % \docValue{right} is right-aligned within the label box, like \texttt{enumerate}; % \docValue{center} is centred within it; % \docValue{flush} aligns the label with the left margin of the item text; % \docValue{runin} does the same but reserves no label area at all: the label becomes the first word of the item, separated from what follows by an ordinary interword space instead of a \refKey{labelsep}, so that it stretches and breaks with the rest of the line; % \docValue{nextline} puts the label on a line of its own, and \docValue{flush-nextline} does both. % Has no effect inside \refEnv{inlineprop} or \refCom{ptag}. (Note that \docValue{runin}, \docValue{nextline} and \docValue{flush-nextline} put the label into the body rather than into the label box.) % \end{docKey} % % \begin{example} % \begin{prop} % \item[L, align=left] Left aligned label. % \item[C, align=center] Center aligned label. % \item[R, align=right] Right aligned label. % \item[Long label, align=center] As in standard \LaTeX\ lists, % longer labels expand to fill the label box and then push % the following text along to make room for themsselves. % \item[Flush label, align=flush] Flush aligned label. % \item[Run-in label, align=runin] Run-in aligned label, which % carries on as ordinary text after a single space. % \item[Sometimes a long label will deserve its own line, % align=nextline] Nextline aligned label. % \item[Another rather long label, % align=flush-nextline] Flush-nextline aligned label. % \end{prop} % \end{example} % % \begin{docKeys}[ % doc parameter = {=\meta{length}}, % ] % { % { doc name = topsep }, % { doc name = partopsep }, % { doc name = itemsep }, % { doc name = parsep }, % { doc name = leftmargin }, % { doc name = rightmargin }, % { doc name = labelwidth }, % { doc name = labelsep }, % { doc name = itemindent }, % { doc name = listparindent }, % { doc name = labelindent }, % } % Override the standard \LaTeX{} list dimensions. Accept the same values as \cs{setlength}, including rubber lengths (e.g.\ \texttt{itemsep=4pt plus 2pt}). % % \refKey{labelindent} is not a standrd \LaTeX{} list dimension. It positions the left edge of the label box at \meta{length} from the enclosing margin. This introduces a redundancy: any one of \refKey{labelindent}, \refKey{labelwidth}, \refKey{leftmargin}, \refKey{labelsep}, or \refKey{itemindent} can be calculated from the four others, via the expression % \[ % \refKey{labelindent} + \refKey{labelwidth} + \refKey{labelsep} = \refKey{leftmargin} + \refKey{itemindent} % \] % Whichever of these is not explicitly set will be computed from the ones that are explicitly set (or from the four most recently explicitly set) in such a way as to guarantee this identity. Each dimension key also accepts the value~\texttt{*}, which means \emph{behave as if the key had not been set}: the dimension takes the document class's default, unless its value must shift to preserve the above identity. This behaviour is identical to that of package \textsf{enumitem}. % % A dimension key can be set to any macro that expands to a dimension. For example, one can set different dimensions for different nesting levels by using \refCom{proplevelchoice}: % \begin{codebox} % \propoptions{leftmargin = \proplevelchoice{2.5em, 0em, *}} % \end{codebox} % (Note that without the \texttt{*}, the last entry 0em would apply at every level below the second.) % \end{docKeys} % % \begin{docKey}{tightspacing}{}{no value} % Sets all vertical spacing to the compact defaults that the standard document classes use for level-three lists (\refKey{topsep} and \refKey{itemsep} to \texttt{2pt} with stretch/shrink, \refKey{parsep} to \texttt{0pt}, \refKey{partopsep} to \texttt{1pt}). % \end{docKey} % % \begin{docKey}{nosep}{}{no value} % Sets \cs{topsep}, \cs{itemsep}, and \cs{parsep} all to zero. % \end{docKey} % % \begin{docCommand}{propformlabel}{} % Expands to the formatted label of the (approximately) \texttt{items}-th item in this % environment, computed at \verb|\begin{prop}| \emph{before} the list dimensions are applied, % so it can be used directly in dimension expressions. % It keeps that value for the whole environment: a dimension key is read % again for each item's label area, and a prediction that changed as the % list went along would size each item's label box to its predecessor's % label. % Typical use: % \begin{codebox} % \begin{prop}[items=20, % leftmargin=\widthof{\propformlabel}+0.5em] % \end{codebox} % sizes the left margin to accommodate labels up to the 20th item. % \end{docCommand} % % \begin{docCommand}{propwidestlabel}{} % The same as \refCom{propformlabel}, but with every digit replaced by the digit that makes the label widest (an~\texttt{8} in many fonts). Using it in place of \refCom{propformlabel} in a dimension expression makes the dimension depend on how many digits the label has rather than on which digits they are, so that a run of numbered environments keeps a steady margin instead of shifting at every change of number. (The substitution is used for measurement only; the labels themselves are untouched.) (Used by the built-in \texttt{fitmargin} and \texttt{outerfit} styles.) % \end{docCommand} % % % \begin{docKey}{items}{=\meta{n}}{initially \texttt{1}} % Indicates that approximately \meta{n} items are expected in this environment. % The only effect of this key is in conjunction with \refCom{propformlabel}, to compute a preview label wide enough for the \meta{n}\/th expected item, so that dimension expressions such as % \texttt{leftmargin=\cs{widthof}\{\refCom{propformlabel}\}+0.5em} reserve enough space for the % widest label. Has no effect on actual item processing or counter stepping. % \end{docKey} % % \begin{docKey}{continue}{=\meta{boolean}}{initially \texttt{true}} % When a \refEnv{prop} environment with \texttt{continue=true} is immediately followed by another such environment (with no intervening % paragraph text), the normal \cs{topsep}-based inter-list % space is replaced with \cs{itemsep}\,+\,\cs{parsep}, giving the visual % appearance of a single continuous list. % \end{docKey} % % \subsection{Other environment-level keys}\label{sect:keys-env} % % The keys in this section have effect in both the \refEnv{prop} and \refEnv{inlineprop} environments. They can also be used with \refCom{propoptions}, |\usepackage|, and \refCom{SetPropStyle}, just like the keys in the previous subsection. % % \begin{docKey}{named style}{=\meta{style}}{initially \texttt{proposition}} % The base style when an \cs{item} or \refCom{ptag} has a value for \refKey{name}. Explicitly given keys, including \refKey{style}, will override whatever is set by this style. % \end{docKey} % % \begin{docKey}{nameless style}{=\meta{style}}{initially \texttt{numbered}} % The base style used when an \cs{item} or \refCom{ptag} has no value for \refKey{name}. % % The choice whether to assign an item \refKey{named style} or the \refKey{nameless style} turns on whether its \refKey{name} is set (either by its own optional argument, or by inheritance from its environment or \refCom{propoptions}). % \end{docKey} % % \begin{docKeys}[ % doc parameter = {= \meta{style}}, % ] % { % { doc name = named ptag style }, % { doc name = nameless ptag style }, % } % If set, override \refKey{named style} and \refKey{nameless style} for \refCom{ptag} items only. % \end{docKeys} % % \begin{docKeys}[ % doc parameter = {=\meta{code}}, % ] % { % { doc name = wrapper begin }, % { doc name = wrapper end }, % } % Insert arbitrary \meta{code} immediately before the beginning and after the end of the environment, so that the whole list can (for example) be wrapped in another environment. % % Any value that contains a comma (such as a comma-separated list of options to an environment) must be enclosed in braces, so that the comma is not read as a key separator: % \begin{example} % \begin{prop}[ % wrapper begin = {\begin{tcolorbox}[ % colframe = red, colback = white]}, % wrapper end = {\end{tcolorbox}}] % \item[Red] A proposition in a red frame. % \item And a second one, in the same frame. % \end{prop} % \end{example} % The wrapping environment must be one that can be split into separate begin and end % code---that is, it must not read its body as a macro argument via \cs{collect@body} or similar. % \end{docKeys} % % The following commands are provided for use with \refKey{wrapper begin} and \refKey{wrapper end}: % \begin{docCommand}{propoperativeleftmargin}{} % A read-only length giving the \refKey{leftmargin} a \refEnv{prop} environment (with no optional argument) would use, given the current defaults set by \refCom{propoptions} and the current nesting level. It is recomputed at every \verb|\begin{prop}|, so it is valid inside a wrapper (before the % environment's own \refKey{leftmargin} has taken effect). For example, the built-in \texttt{framed} style uses this command in the value of \refKey{wrapper begin} to make the margins of framed environments match those of regular environments. % \end{docCommand} % % \begin{docCommands}{ % { doc name = propsetabove, doc parameter = \oarg{space above}\oarg{space below}\marg{material} }, % { doc name = propsetbelow, doc parameter = \oarg{space above}\oarg{space below}\marg{material} }, % } % For use in \refKey{wrapper begin} and \refKey{wrapper end} (respectively): sets \meta{material} in the gap above or below the list, at the list's own left margin, and vertically centred between the adjacent line of the list and the line before or after it. The two optional arguments add vertical space on either side of it, and either may be negative. % % \end{docCommands} % % \begin{example} % \begin{prop}[ % wrapper begin = \propsetabove[0.2em][0.2em]{% % \rule{\linewidth}{0.4pt}}, % wrapper end = \propsetbelow[0.2em][0.2em]{% % \rule{\linewidth}{0.4pt}}] % \item A proposition bracketed by rules. % \item And a second one. % \end{prop} % \end{example} % % \subsection{Global key} % \label{sect:keys-global} % % The following key can only be set in the optional argument of |\usepackage|, or in the preamble with \refCom{propoptions}. % \begin{docKey}{equations}{}{no value, \textbf{global only}} % Installs hooks so that the \LaTeX\ and \textsf{amstex} displayed equation environments (such as \texttt{equation} and \texttt{align}) use the same formatting as the special \texttt{equation} prop style. The \texttt{equation} style's \refKey{display format} and \refKey{ref format} keys are used for generating equation numbers and cross-references to them. % % Redefining the \texttt{equation} style, e.g.~with %\begin{codebox} % \SetPropStyle{equation}{format = [#1]} %\end{codebox} % will automatically update the hooks. % % The \refKey{equations} key also sets \texttt{nameless style\,=\,eqnum}, so that top-level |\item|s with no name will also use the \texttt{equation} style, while lower-level |\item|s will use other kinds of numbering: for details, see \cref{sect:builtin-styles} below. % % \end{docKey} % % \section{Cross-referencing commands}\label{sect:xref} % % Labels placed after |\item| items (within \refEnv{prop}) work with the standard % |\label|/|\ref| mechanism. The key difference from ordinary % \LaTeX{} references is that |\ref| produces \emph{formatted} % output: for example, |\textbf| might be applied to the name, or the number might be wrapped in parentheses. The formatting is controlled by the |format| key (or separately by |display format| and |ref format|). % % \begin{docCommands}{ % { doc name = Ref, doc parameter = \marg{label} }, % { doc name = {Ref*}, doc parameter = \marg{label} }, % } % Titlecase variants of |\ref| and |\ref*|: uppercases the first letter of the % formatted output. (For example, if |\ref{thesis}| produces % `the Identity Theory', then |\Ref{thesis}| produces % `The Identity Theory'.) The starred form suppresses the hyperlink. % Note: |\Ref| only affects references produced by this package (which are stored % via \refCom{propapply}); for other references, it behaves like |\ref|. % \end{docCommands} % % \begin{docCommands}{ % { doc name = nref, doc parameter = \marg{label} }, % { doc name = {nref*}, doc parameter = \marg{label} }, % { doc name = Nref, doc parameter = \marg{label} }, % { doc name = {Nref*}, doc parameter = \marg{label} }, % } % ``Naked ref.'' Outputs the bare reference content with all formatting stripped. If \cs{ref}\texttt{\{premise\}} produces~`(P1)', then \cs{nref}\texttt{\{premise\}} produces~`P1'. The starred form suppresses the hyperlink. \cs{Nref} is the titlecase variant: it uppercases the first letter of the bare content. % \end{docCommands} % % |\nref| can be useful in the argument of |\item|, when the % the name of one proposition should depend on that of another: % \begin{example} % \SetPropStyle{proposition}{format=(\textbf{#1})} % \begin{prop} % \item[Phys] Everything is physical. \label{phys2} % \item[\nref{phys2}*] Almost everything is physical. % \label{newphys2} % \item[\ref{phys2}*] This one has two sets of parentheses, % which is probably not desired! Note that % the previous proposition \ref{newphys2} avoided this by using % |\nref| in the optional argument % of |\item|. % \end{prop} % \end{example} % % \emph{Warning:} documents where the name of one item includes % a reference to that of another, and there are further % references to that item, will require multiple % \LaTeX\ runs to resolve all references. To save time, % it is better to avoid long chains of dependencies of this sort. % % \begin{docCommands}{ % { doc name = oref, doc parameter = \oarg{prefix}\oarg{suffix}\marg{label} }, % { doc name = {oref*}, doc parameter = \oarg{prefix}\oarg{suffix}\marg{label} }, % { doc name = Oref, doc parameter = \oarg{prefix}\oarg{suffix}\marg{label} }, % { doc name = {Oref*}, doc parameter = \oarg{prefix}\oarg{suffix}\marg{label} }, % } % ``Ref with options.'' Extends \cs{ref} by injecting a prefix and/or suffix \emph{inside} the formatting. With one optional argument, \meta{suffix} is appended; with two, \meta{prefix} is prepended and \meta{suffix} appended. For instance, if \cs{ref}\texttt{\{premise\}} produces~`(P1)', then \cs{oref}\texttt{[*]\{premise\}} produces~`(P1*)' and \cs{oref}\texttt{[old\string~][*]\{premise\}} produces~`(old\string~P1*)'. % % \cs{Oref} is the titlecase variant; the starred forms suppress the hyperlink. % \end{docCommands} % % |\oref| can also be useful in the name of |\item|s, if % one wants the display format for the modified item % to depend on that originally used % \begin{example} % \begin{prop} % \item[style=plain, name=\oref[$^\dag$]{phys2}] % This will use boldface and parentheses because the % original referenced item did. % \end{prop} % \end{example} % % Another handy use for |\oref| is in combination with |\nref| to refer to ranges: % \begin{example} % The first two numbered examples in this document % were \oref[--\nref{atomism}]{atoms}. % \end{example} % % % \begin{docCommands}{ % { doc name = lastref, doc parameter = \oarg{prefix}\marg{suffix} }, % { doc name = Lastref, doc parameter = \oarg{prefix}\marg{suffix} }, % } % Produces a reference (witth no hyperlink) to the most recently processed \cs{item} or \refCom{ptag}, even without a \cs{label}. Useful for back-references in running text. With one argument, \meta{suffix} is appended; with two, \meta{prefix} is also prepended. Use \cs{lastref}\texttt{\{\}} for a plain reference. \cs{Lastref} is the titlecase variant. % \end{docCommands} % % \begin{docCommands}{ % { doc name = nlastref, doc parameter = {} }, % { doc name = nLastref, doc parameter = {} }, % } % Like \cs{lastref}\texttt{\{\}}, but returns the bare content without formatting. \cs{nLastref} is the titlecase variant. % \end{docCommands} % % \begin{docCommands}{ % { doc name = parentref, doc parameter = \oarg{prefix}\marg{suffix} }, % { doc name = Parentref, doc parameter = \oarg{prefix}\marg{suffix} }, % } % Inside a nested \refEnv{prop} (or \refEnv{inlineprop}), produces a formatted reference to the most recent item of the enclosing level. Same argument convention as \refCom{lastref}. \cs{Parentref} is the titlecase variant. % \end{docCommands} % % \begin{docCommands}{ % { doc name = nparentref, doc parameter = {} }, % { doc name = nParentref, doc parameter = {} }, % } % Like \cs{parentref}\texttt{\{\}} but returns the bare content without formatting. Takes no arguments; simply output any desired suffix directly afterwards. \cs{nParentref} is the titlecase variant. % \end{docCommands} % % \refCom{parentref} and \refCom{nparentref} are useful for making subitems whose names derive from their parent's: % \begin{example} % \begin{prop} % \item[P1, ref format=(#1)] \label{claim} % \begin{prop}[counter format=\alph{#1}, % display format=\textit{#1.}, ref format=\parentref{#1}] % \item \label{positive} % Some things are physical. % \item \label{negative} % Some things are not physical. % \end{prop} % \end{prop} % Of the two parts of \ref{claim}, \ref{positive} is far more controversial than \ref{negative}. Thus, we will mostly be considering part \nref{negative}. % \end{example} % % Many of the built-in numbered styles use \refCom{parentref} in their \refKey{ref format}, to achieve this sort of composite effect. % % \subsection{How cross-referencing works} % % \begin{docCommand}{propapply}{\marg{template}\marg{content}} % Internally, each reference is stored in the \texttt{.aux} file as \cs{propapply}\marg{template}\marg{content}. The \meta{template} contains formatting with the placeholder \refCom{propfmtarg} where content appears. At reference time, \cs{propapply} evaluates the template with \refCom{propfmtarg} bound to \meta{content}. The \refCom{oref} and \refCom{nref} commands work by locally redefining \cs{propapply}. % % In normal use, you need not interact with \cs{propapply} directly. % \end{docCommand} % % \begin{docCommand}{propfmtarg}{} % Placeholder used inside templates; expands to the content argument of the enclosing \refCom{propapply}. % \end{docCommand} % % \section{Defining and modifying styles}\label{sect:styles} % % Styles, equivalent to bundles of key-value settings, % can be defined, and used freely in the optional arguments of |\item|, \refCom{ptag}, \refEnv{prop}, \refEnv{inlineprop}, and the argument of \refCom{propoptions}. % Styles can freely be combined, and the definition of % one style can reference another (in which case redefining % the latter style will change the effect of the former style.) % % \begin{docCommand}{SetPropStyle}{\marg{name}\marg{keys}} % Defines or modifies a prop style for use with the \refKey{style} key. All item-level keys (\autoref{sect:keys-item}) are accepted, plus the following: % \end{docCommand} % % \begin{docKey}[][doc label=setpropstyle/style]{style}{=\meta{parent}}{no default} % Inherit from a parent style. When an item is created, the parent's settings are loaded first (recursively, if the parent itself has a parent), then this style's own keys are applied on top. % % The argument may be a macro which is expanded when the item is created: for example, a style with \texttt{style=}\cs{\proplevelchoice}\texttt{{\marg{style1},\marg{style2},\marg{style3}}} will resolve to \marg{style1}, \marg{style2}, \marg{style2} depending on the nesting depth. The built-in \texttt{numbered} and \texttt{eqnum} styles use this mechanism. % \end{docKey} % % \begin{docKey}{macro}{=\meta{command}}{no default} % A new user macro, equivalent to \cs{item}\texttt{[style=}\meta{name}\texttt{]}. Any further keys given to the macro are passed to \cs{item}. % \end{docKey} % % If the style \meta{name} already exists, \refCom{SetPropStyle} modifies or adds keys. For example, |\SetPropStyle{proposition}{align=flush}| changes the alignment of the built-in |proposition| style while preserving its other settings. % % % \begin{example} % \SetPropStyle{angle}{ % labelindent = 0em, % display format = \textbf{$\langle$#1$\rangle$}, % ref format = $\langle$#1$\rangle$, % macro = \angitem % } % \begin{prop} % \angitem[Angle thesis] Everything is angular. % \end{prop} % No further discussion of \lastref{} is needed. % \end{example} % % \begin{docCommand}{DeclareNumberedStyle}{\marg{name}\oarg{keys}} % Creates a new \LaTeX{} counter named \meta{name} and a matching prop style with \texttt{counter=}\meta{name}. All \refCom{SetPropStyle} keys are accepted, plus: % \end{docCommand} % % \begin{docKey}{parent}{=\meta{counter}}{no default} % A parent counter; the new counter resets when the parent steps (same mechanism as \cs{numberwithin}). For numbering that begins again at each list rather than running through the document, see \docCounter{enumprop} under \refKey{counter}. % \end{docKey} % % \begin{example} % \DeclareNumberedStyle{P} % \begin{prop} % \item[counter=P] First premise. \label{p1} % \item[counter=P] Second premise. \label{p2} % \end{prop} % From \ref{p1} and \ref{p2}\ldots % \end{example} % % \section{Built-in styles}\label{sect:builtin-styles} % % The following prop styles are predefined. % Each entry shows the defining code (using user-facing commands), % and each group of styles ends with a live example. % All styles can be modified with \refCom{SetPropStyle}; the definitions are reproduced here to facilitate modification. % % \subsubsection*{Text styles} % % \begin{description} % \item[\texttt{plain}] Unformatted text label. % \begin{codebox} % \SetPropStyle{plain}{format = #1} % \end{codebox} % % \item[\texttt{proposition}] The standard style assigned to named propositions. By default, uses boldface for both the label and references. % \begin{codebox} % \SetPropStyle{proposition}{format = \textbf{#1}} % \end{codebox} % % \item[\texttt{thesis}] Intended for named propositions with a longer name. The name begins at the text margin (\texttt{flush} alignment), and is set in small caps; references use plain font. % \begin{codebox} % \SetPropStyle{thesis}{display format = \textsc{#1}, % ref format=#1, align = flush} % \end{codebox} % % \item[\texttt{vignette}] Intended for things like example vignettes and comments. Italic name at the text margin, and italic references, separated from the text by a colon and ordinary space space. % \begin{codebox} % \SetPropStyle{vignette}{ref format = \textit{#1}, % align = runin, label format = \textit{#1:}} % \end{codebox} % % \item[\texttt{bullet}] Bullet symbol varying by depth (like |\itemize|). % \begin{codebox} % \SetPropStyle{bullet}{align = center, % name = \proplevelchoice{\textbullet, % {\normalfont\textendash}, \textasteriskcentered, % \textperiodcentered}, % display format = #1} % \end{codebox} % % \item[\texttt{nolabel}] A special style for creating items with no labels. Also sets \refKey{reset}\,=\,\texttt{false}, so these items will not disrupt the numbering of sub-lists. % \begin{codebox} % \SetPropStyle{nolabel}{counter = none, name = {}, % reset = false} % \end{codebox} % \end{description} % % \begin{example} % \begin{prop} % \item[One, style=plain] \label{bs:plain} % A proposition in style |plain|, cited as \ref{bs:plain}. % \item[Two, style=proposition] \label{bs:prop} % A proposition in style |proposition|, cited as \ref{bs:prop}. % \item[Three, style=thesis] \label{bs:thesis} % A proposition in style |thesis|, cited as \ref{bs:thesis}. % \item[Four, style=vignette] \label{bs:vignette} % A proposition in style |vignette|, cited as \ref{bs:vignette}. \\ % % \textit{Test:} Another line as a test. Less space here, no? % \item[style=bullet] \label{bs:bullet} % A proposition in style |bullet|, cited as \ref{bs:bullet}---though % it is not often that one would want to cite an item in this style. % \item[style=nolabel] % A proposition in style |nolabel|. % \end{prop} % \end{example} % % \subsubsection*{Numbered styles} % % \begin{description} % \item[\texttt{numbered}] The default nameless style. Selects one of % the helper styles \texttt{levelone}--\texttt{levelfive}, depending % on nesting depth, ofr \texttt{footnumprop} if in a footnote and not nested. % \begin{codebox} % \SetPropStyle{levelone}{counter = numpropi, format = (#1)} % \SetPropStyle{leveltwo}{counter = numpropii, % display format = #1., ref format = \parentref{#1}} % \SetPropStyle{levelthree}{counter = numpropiii, % display format = (#1), ref format = \parentref{.#1}} % \SetPropStyle{levelfour}{counter = numpropiv, % display format = #1., ref format = \parentref{#1}} % \SetPropStyle{levelfive}{counter = numpropv, % display format = (#1), ref format = \parentref{.#1}} % \SetPropStyle{numbered}{style = \proplevelchoice{ % \propfootnotechoice{levelone}{footnumprop}, % leveltwo, levelthree, levelfour, levelfive}} % \end{codebox} % % \item[\texttt{footnumprop}] The counter is displayed as a string of asterisks. This style is designed to be used for numbered propositions in footnotes, which should not interrupt the numbering in the main text. Note that the nesting % level resets to zero inside footnotes, so a \texttt{numbered} (or % \texttt{eqnum}) proposition immediately inside a footnote will always use % this style. % \begin{codebox} % \SetPropStyle{footnumprop}{counter = footprop, % counter format = \proprepeat{#1}{*}, format = (#1)} % \end{codebox} % % \item[\texttt{equation}] Uses the |equation| counter. Note that this style has a special behavior when the |equations| option is active: changing its \refKey{display format} and \refKey{ref format} keys (or both, by setting \refKey{format}) will also change the corresponding hooks used to create the tags for numbered equations make the \texttt{equation} environment and \textsf{amstex} environments like \texttt{gather}. % \begin{codebox} % \SetPropStyle{equation}{counter = equation, format = (#1)} % \end{codebox} % \end{description} % % \begin{description} % \item[\texttt{eqnum}] Like |numbered|, but uses |equation| instead % of |levelone| at the outer level. The |equations| package option sets % |default nameless style = eqnum|. Since this manual uses this option, % its outer-level nameless items use the |equation| style. % \begin{codebox} % \SetPropStyle{eqnum}{style = \proplevelchoice{ % \propfootnotechoice{equation}{footnumprop}, % leveltwo, levelthree, levelfour, levelfive}} % \end{codebox} % % \item[\texttt{enum}] Like |numbered| again, but at the outer level it uses % \texttt{enumprop}, which restarts at every outermost \refEnv{prop}, so % that the list is numbered from one however many have gone before. This is % the style for a one-off lists---the behaviour of \texttt{enumerate}---where % \texttt{numbered}/\texttt{eqnum} is for numbered propositions that carry on through the document. % \begin{codebox} % \SetPropStyle{enumprop}{counter = enumprop, format = (#1)} % \SetPropStyle{enum}{style = \proplevelchoice{ % enumprop, leveltwo, levelthree, levelfour, levelfive}} % \end{codebox} % \end{description} % % \begin{example} % \begin{prop} % \item \label{outer} % This is an outermost numbered item. Since the default style for % nameless items is |eqnum|, it uses the |equation| style. % \begin{prop} % \item \label{second} % This is a second level item, using |leveltwo|. % \begin{prop} % \item \label{third} % This is a third level item, using |levelthree|. % \begin{prop} % \item \label{fourth} % This is a fourth level item, using |levelfour|. % \begin{prop} % \item \label{fifth} % This is a fifth level item, using |levelfive|. % \end{prop} % \item Another fourth level item. % \end{prop} % \item Another third level item. % \end{prop} % \item Another second level item. % \end{prop} % \end{prop} % We hope you enjoyed reading \ref{outer}, \ref{second}, \ref{third}, % \ref{fourth}, and \ref{fifth}. % % \begin{prop}[style=enum] % \item This list will be numbered from one. % \item If both kinds of lists are used in the same % document, they had better be formatted differently % so readers don't get confused. % \end{prop} % \end{example} % % \begin{description} % \item[\texttt{roman}] Roman numerals. At the % outer level, they use their own counter (reset every section); inside % nested lists, they use the counter appropriate to the nesting % level, so one can easily make roman-numbered sublists. % \begin{codebox} % \DeclareNumberedStyle{roman}[parent = section, % counter format = \roman{#1}, format = (#1)] % \SetPropStyle{roman}{counter = \proplevelchoice{ % roman, numpropii, numpropiii, numpropiv, numpropv}} % \end{codebox} % % \item[\texttt{alph}] Letters. Works the same as |roman|, but with % letters. Uses its own dedicated counter at the outer level. % \begin{codebox} % \DeclareNumberedStyle{alph}[parent = section, % counter format = \alph{#1}, display format=#1., % ref format = (#1)] % \SetPropStyle{alph}{counter = \proplevelchoice{ % alph, numpropii, numpropiii, numpropiv, numpropv}} % \end{codebox} % % \begin{example} % \begin{prop} % \item[Basic classification, ref format={the \textit{#1}}] % There are three kinds of people. \label{complex} % \begin{prop} % \item[style=roman] \label{partone} Those who know how to count, % comprising in turn: % \begin{prop} % \item[style=alph] \label{parta} Those who know how to count up to % some number, but not beyond. % \item[style=alph] \label{partb} Those who can keep going indefinitely. % \end{prop} % \item[style=roman] \label{parttwo} Those who do not know how to count. % \end{prop} % \end{prop} % For \ref{complex} to serve its purpose, both \ref{partone} (and % its two components \ref{parta} and \ref{partb}) and % \ref{parttwo} are needed. % \begin{prop} % \item[style=roman] % The |roman| and |alph| styles are also useful for creating ad-hoc % numbered lists at the outer level. % \item[style=roman] % Like this one. % \end{prop} % \end{example} % % \item[\texttt{hierarchical}] Produces 1, 1.1, 1.1.1\,\ldots\ numbering. Defined via two helper styles: % \begin{codebox} % \SetPropStyle{h-base}{counter = numpropi, % counter format = \arabic{#1}, ref format = #1, % display format = #1.} % \SetPropStyle{h-sub}{ % counter = \proplevelchoice{numpropi, numpropii, % numpropiii, numpropiv, numpropv}, % counter format = \arabic{#1}, % format = \parentref{.#1}} % \SetPropStyle{hierarchical}{style = \proplevelchoice{ % h-base, h-sub}, tightspacing} % \end{codebox} % \end{description} % % Note that since the optional arguments of \refEnv{prop} and \refEnv{inlineprop} only affect the |\item|s in the \emph{immediate} scope of that environment (not of any nested environments), styles like |hierarchical|, which one presumably wants to apply to apply an environment along with all its sub-environements, sub-sub-environments, etc., will need to be set using \refCom{propoptions}. (The scope of \refCom*{propoptions} can be controlled by creating a \TeX{} group.) % % \begin{example} % \begingroup % \propoptions{style = hierarchical, leftmargin=3em, labelindent=0em} % \begin{prop} % \item \label{theworld} The world is everything that is the case. % \begin{prop} % \item \label{totality} % The world is the totality of facts, not of things. % \begin{prop} % \item % The world is determined by the facts, and by their being all the % facts. % \item % For the totality of facts determines what is the case, and also % whatever is not the case. % \end{prop} % \end{prop} % \end{prop} % Proposition \ref{totality} helps elucidate the meaning of % proposition \ref{theworld}. % \endgroup % \end{example} % % % \subsubsection*{Environment-level styles} % % These styles are designed to be used in % the optional argument of \refEnv{prop} or \refEnv{inlineprop}. % % \begin{description} % \item[\texttt{fitmargin}] Fits the left margin to the predicted width of the % label (computed using \refCom{propwidestlabel}), so that the label will never % extend past the left margin of the following text. % \begin{codebox} % \SetPropStyle{fitmargin}{ % labelindent = 0pt, % leftmargin = \widthof{\propwidestlabel} + \labelsep} % \end{codebox} % (Explanation: \refCom{propwidestlabel} computes the widest label the environment's items are expected to produce. By setting \refKey{labelindent} to zero, we make sure that the \refKey{labelwidth} will be sized to fit the computed \refKey{leftmargin}.) % % When a list will contain several numbered items, you can use the \refKey{items} key to tell the environment how many |\item|s it contains, so that it can properly anticipate how wide the widest label will be. % \end{description} % % \begin{example} % \begin{prop}[name=Fitted Margin, style=fitmargin] % \item Notice that the |name| key needs to be set in the optional % argument of |prop| rather than |item|, so that the style knows % how much space needs to be reserved. % \end{prop} % \begin{prop}[items=2, style=fitmargin] % \item % The use of |items=2| is crucial here; without it, we would % only reserve enough space for a one-digit number. % \item % This happens to be where the |equation| counter hits value 10. % \end{prop} % The |hierarchical| style arguably looks better combined with |fitmargin|: % \begingroup % \propoptions{style=hierarchical, style=fitmargin} % \begin{prop} % \item What is the case---a fact---is the existence of states of affairs. % \begin{prop} % \item A state of affairs (a state of things) is a combination % of objects (things). % \begin{prop} % \item % It is essential to things that they should be possible % constituents of states of affairs. % \item % In logic nothing is accidental: if a thing can occur in a % state of affairs, the possibility of the state of affairs % must be written into the thing itself. % \end{prop} % \end{prop} % \end{prop} % \endgroup % \end{example} % % \begin{description} % \item[\texttt{outerfit}] % This style behaves similar to \texttt{fitmargin} at the outer nesting level (with a bit more space between label and text), but does nothing at other levels. Intended to be set once using \refCom{propoptions}, for a document that wants `fitmargin'-like behavior for its top-level propositions, but not for lower-level propositions (where adjusting to acommodate, e.g., roman numerals of different lengths would be a delicate task). % % This matches the behaviour of the |\ex.| command in package % \textsc{linguex}, widely used in linguistics. % % \begin{codebox} % \SetPropStyle{outerfit}{ % labelindent = \proplevelchoice{0pt, *}, % leftmargin = \proplevelchoice{ % \widthof{\propwidestlabel} + 1.3em, *}} % \end{codebox} % (Note the use of \texttt{*} in the argument of \refCom{proplevelchoice}, which leaves the deeper levels as though neither key had been set.) % \end{description} % % \begin{description} % \item[\texttt{framed}] Puts an outline around a list (requires the \textsf{tcolorbox} % package to be loaded). Change the % padding with \verb|\setlength\propframepad{...}|. % \begin{codebox} % \SetPropStyle{framed}{ % align = flush, leftmargin = 0pt, rightmargin = 0pt, % labelindent = {}, continue = false, % wrapper begin = {\begin{tcolorbox}[ % colback = white, colframe = black, % boxrule = 0.4pt, arc = 0pt, boxsep = 0pt, % left skip = % \dimexpr\propoperativeleftmargin-\propframepad\relax, % right skip = % \dimexpr\propoperativeleftmargin-\propframepad\relax, % left = \propframepad, right = \propframepad, % top = \propframepad, bottom = \propframepad]}, % wrapper end = {\end{tcolorbox}}, % } % \end{codebox} % (Explanation: \texttt{leftmargin\,=\,0} means that the left margin \emph{inside} the frame is zero. But the use of % \refCom{propoperativeleftmargin} indents the whole \texttt{tcolorbox} environment by the right amount for the the % left margin of the enclosed material to appear at the same position that would have been used for a list without the \texttt{frame} style, with the frame rule one % \cs{propframepad} further out.) % % \begin{example} % \begin{prop}[style=framed] % \item[Important Claim] % This claim is so important that it deserves to % put in a special box! % \end{prop} % \end{example} % % \item[\texttt{conclusion}] Draws a rule immediately before the list: intended to be used to display the conclusion of an argument whose premises have just been stated. % \begin{codebox} % \SetPropStyle{conclusion}{wrapper begin = % \propsetabove[0.2em][0.2em]{\smash{\rule{\linewidth}{0.4pt}}}} % \end{codebox} % % \begin{example} % \begin{prop}[counter=enumprop, format=\textbf{P#1}] % \item Everything mental has physical effects. % \item Everything that has physical effects is physical. % \end{prop} % \begin{prop}[style=conclusion] % \item[C] Everything mental is physical. % \end{prop} % \end{example} % % \item[\texttt{standard}] % Resets all the environment-level keys back to their default values---potentially useful, since there is otherwise no easy way to `unset' a globally-set style. Item-level keys like \refKey{align} and \refKey{display format} are not affected, so these will still be set by the the operative \refKey{named style} or \refKey{nameless style} defaults. (To reset \refKey*{align} along with the other keys, just set \verb|[style=standard, align=left]|.) % \end{description} % % % \section{Compatibility} % % The \textsf{propositions} package is designed to work with \textsf{hyperref}, \textsf{cleveref}, \textsf{zref-clever}, \textsf{amsmath}, and \textsf{tcolorbox}. % \begin{itemize} % \item % \textsf{amsmath} is required for \refCom{ptag} and the |equations| option. % \item % With \textsf{hyperref} loaded, all cross-referencing % commands generate hyperlinks, as usual. % \item % With \textsf{cleveref} or \textsf{zref-clever} loaded, all proposition items are assigned to a private |prop| ``reference type'', which by default has no special name, so |\cref| (with \textsf{cleveref}) or |\zcref| (with \textsf{zref-clever}) will generate the same output as |\ref|. The |crefname| key can override this and set a different reference type.. % \item % The built-in \texttt{framed} style requires \textsf{tcolorbox} to be loaded. % \end{itemize} % None of these packages has to be loaded in any particular order relative to % \textsf{propositions}: each is detected either at load time or at % \verb|\begin{document}|, whichever is needed. The usual external conventions % still apply---\textsf{hyperref} late, and \textsf{cleveref} after % \textsf{hyperref}. % % \section{Known issues} % % When using \refCom{ptag} with a named counter (e.g.\ |\ptag[counter=P]|) % inside an \textsf{amsmath} equation environment, \textsf{hyperref} % may emit warnings of the form: % \begin{Verbatim}[gobble=2] % pdfTeX warning: destination with the same % identifier (name{equation.N}) has been already % used, duplicate ignored % \end{Verbatim} % These warnings are harmless and do not affect the correctness % of cross-references. % % \section{Release notes} % % \begin{description} % \item[0.91] New \refKey{align} value \texttt{runin}, and the built-in style \texttt{vignette} changed to use it. % % New style \texttt{enum} and counter \docCounter{enumprop}. % % \textsf{zref-clever} is now supported alongside \textsf{cleveref}, through % the same \refKey{crefname} key. % % New style \texttt{conclusion}, which uses new commands \refCom{propsetabove} and \refCom{propsetbelow} that % place material in the gap above or below a list. % % New style \texttt{nolabel}, for an item with no label at all, and % \refKey{counter}\,=\,\texttt{none} is now documented. An item with % nothing to refer to no longer takes a \refKey{ref format}: \cs{ref} to it % printed \texttt{()} rather than nothing. % % An item carrying \refKey{reset}\,=\,\texttt{false} no longer becomes the % parent of the sub-list that follows it, so a run of sub-items interrupted by % an aside keeps the prefix it began with instead of picking up the aside's. % (This is a change: such sub-references used to take each intervening item as % their parent, giving runs like \texttt{1a}, \texttt{1b}, \texttt{2c}.) % % Propositions in footnotes are numbered with asterisks by the new style % \texttt{footnumprop} and counter \docCounter{footprop}, and the nesting % level now resets inside a footnote. New commands \refCom{proprepeat} and % \refCom{propfootnotechoice}. % % The \texttt{prop} counter, stepped by every \refEnv{prop} and % \refEnv{inlineprop} but never displayed, has been withdrawn. % % Stray spaces around a \refKey{name} are trimmed, so that % \verb|\item[ Alpha ]| places its label like \verb|\item[Alpha]|. % % Equation tags hand \refKey{display format} a bare number, rather than one % wrapped in \textsf{amsmath}'s spacing guards. % \item[0.9] Initial public release. % \end{description} % % \StopEventually{} % % \section{Implementation} % % \begin{macrocode} %<*package> % propositions.sty --- A flexible system for labelling and cross-referencing displayed propositions. \ProvidesExplPackage {propositions} {2026/08/07} {0.91} {Proposition labeling with key-value interface} \RequirePackage { calc } % ==================================================================== % Internal variables % ==================================================================== % --- Nesting level --- \int_new:N \g__props_level_int % --- Footnotes --- % Whether we are inside footnote text, and the state to restore on leaving it % (see \__props_footnote_begin:). \bool_new:N \l__props_in_footnote_bool \int_new:N \l__props_saved_level_int \bool_new:N \l__props_saved_dispmode_bool \bool_new:N \l__props_saved_lastprop_bool \bool_new:N \l__props_saved_topsep_bool \tl_new:N \l__props_saved_last_tpl_tl \tl_new:N \l__props_saved_last_cnt_tl \seq_new:N \l__props_saved_parent_tpl_seq \seq_new:N \l__props_saved_parent_cnt_seq % --- Per-item state (set during \item / \ptag processing) --- % These are cleared at the start of \__props_resolve_item:n and then % populated by key parsing and style loading. Emptiness of a tl % indicates the key was not set (no separate boolean tracking needed). \tl_new:N \l__props_name_tl \tl_new:N \l__props_style_tl \tl_new:N \l__props_counter_tl \tl_new:N \l__props_alignment_tl \tl_new:N \l__props_pi_labelwidth_tl \tl_new:N \l__props_pi_labelsep_tl \tl_new:N \l__props_pi_itemindent_tl \tl_new:N \l__props_pi_labelindent_tl \dim_new:N \l__props_save_labelwidth_dim \dim_new:N \l__props_save_labelsep_dim \dim_new:N \l__props_save_itemindent_dim \tl_new:N \l__props_ref_tl \tl_new:N \l__props_label_tl \tl_new:N \l__props_shorthand_tl \tl_new:N \l__props_gloss_tl % Format functions (one-argument macros set by keys / style loading). % These always have a definition (defaulting to identity or a standard format), % so unlike the tl variables above, their "was set" status cannot be inferred % from their value. \cs_new:Npn \l__props_displayfmt:n #1 { #1 } \cs_new:Npn \l__props_reffmt:n #1 { #1 } \cs_new:Npn \l__props_shorthandfmt:n #1 { ~ [#1] } \cs_new:Npn \l__props_glossfmt:n #1 { ~ (#1) } \cs_new:Npn \l__props_labelfmt:n #1 { #1 } \cs_new:Npn \l__props_counterfmt:n #1 { } %% empty = not set \bool_new:N \l__props_has_counter_format_bool % --- Environment mode --- % True inside a prop environment, false inside inlineprop. % Controls whether \item outputs a display label or inline text. \bool_new:N \g__props_display_mode_bool % --- Global settings --- \tl_new:N \l__props_named_style_tl %% default style for named items \tl_new:N \l__props_named_ptag_style_tl %% ptag override for named items; empty = fall back \tl_new:N \l__props_nameless_style_tl %% default style for nameless items \tl_new:N \l__props_nameless_ptag_style_tl %% ptag override for nameless; empty = fall back \bool_new:N \g__props_equations_bool %% true if equations package option is set \bool_new:N \g__props_eqhooks_bool %% true if equation format hooks should be installed \cs_new:Npn \__props_eqdispfmt:n #1 { (#1) } %% display format for equation tags \cs_new:Npn \__props_eqreffmt:n #1 { (#1) } %% ref format for equation labels % --- Working variables --- \tl_new:N \l__props_display_text_tl %% what appears in the document \tl_new:N \l__props_ref_text_tl %% what goes into \@currentlabel \tl_new:N \l__props_item_output_tl %% formatted display (displayfmt + shorthand + gloss) \tl_new:N \l__props_item_arg_tl %% per-item argument, bare name normalised to name={...} \tl_new:N \l__props_keylist_tl %% the three default layers plus the item argument, assembled \bool_new:N \l__props_valueless_key_bool %% true when an entry of that argument is a key given without a value \bool_new:N \l__props_ptag_bool %% true during \ptag processing \bool_new:N \l__props_body_started_bool %% true when the label has already begun the item body (nextline, flush-nextline, runin) \bool_new:N \l__props_counter_stepped_bool %% true if this item stepped its counter \bool_new:N \l__props_titlecase_bool %% true when \Ref etc. want titlecasing \bool_new:N \l__props_reset_bool %% true (default) = reset sub-level counter on \item \bool_new:N \l__props_pi_any_bool %% true if any per-item dimension is set for this item \tl_new:N \l__props_eqtag_tl %% equation number handed to the display format by \tagform@ %% Two layers of item-level defaults. The cascading layer (\l__props_defaults_tl) %% is fed by \propoptions and is inherited by nested environments; the env-local %% layer (\l__props_env_defaults_tl) is fed by a prop's own optional argument and %% is reset at the start of every environment, so an argument styles only that %% environment's items, not those of any sub-environment. \l__props_env_arg_bool %% routes keys to the right layer (true while a prop argument is being read). \tl_new:N \l__props_defaults_tl \tl_new:N \l__props_env_defaults_tl \bool_new:N \l__props_env_arg_bool \bool_new:N \l__props_loading_defaults_bool %% true during the single processing pass so style= loads immediately \int_new:N \l__props_env_items_int %% items=n key (default 1; used by preview computation) \int_set:Nn \l__props_env_items_int { 1 } \tl_new:N \g__props_env_preview_label_tl %% preview label built at env open for \propformlabel % --- Parent-ref stacks and last-item storage --- % Two global seq stacks hold the template/content of the parent item. % Pushed on \begin{prop}/\begin{inlineprop}, popped on \end. % Two global tl variables hold the most recent item's template/content, % used by \lastref/\nLastref for linguex-style back-references. \seq_new:N \g__props_parent_tpl_seq \seq_new:N \g__props_parent_cnt_seq \tl_new:N \g__props_last_tpl_tl \tl_new:N \g__props_last_cnt_tl % --- Anchor counter for hyperref --- \newcounter { prop@anchor } % Make hyperref destinations deterministic (not dependent on Hy@linkcounter, % which amsmath does not save/restore between measuring and output passes). % Note: hyperref prepends "prop@anchor." automatically in \H@refstepcounter, % so \theHprop@anchor only needs the unique suffix. \def \theHprop@anchor { \the\value{prop@anchor} } % ==================================================================== % \propapply — format/content separation for cross-references % ==================================================================== % % \propfmtarg is a protected placeholder. In the aux file, format % templates contain \propfmtarg where the content should go. % \propapply{