diff options
Diffstat (limited to 'macros/latex/contrib')
26 files changed, 1388 insertions, 212 deletions
diff --git a/macros/latex/contrib/exesheet/README.md b/macros/latex/contrib/exesheet/README.md index 0f6ff627cd..6ce9032857 100644 --- a/macros/latex/contrib/exesheet/README.md +++ b/macros/latex/contrib/exesheet/README.md @@ -10,7 +10,7 @@ This package offers the following features: - macros for organizing exercises and subparts, - specific settings for enumeration lists, - environments for questions and answers, with conditional display, -- macros to display a marking scheme with detailed comments in thee margins. +- macros to display a marking scheme with detailed comments in the margins. ## Installation diff --git a/macros/latex/contrib/exesheet/exesheet.dtx b/macros/latex/contrib/exesheet/exesheet.dtx index 1e5355ba3a..2baac97fae 100644 --- a/macros/latex/contrib/exesheet/exesheet.dtx +++ b/macros/latex/contrib/exesheet/exesheet.dtx @@ -23,7 +23,7 @@ %<class>\ProvidesClass{exesheet} %<package>\ProvidesPackage{exesheet} %<*class|package> -[2023/08/25 v2.1 .dtx exesheet file] +[2023/09/05 v2.2 .dtx exesheet file] %</class|package> %<*driver> \documentclass{ltxdoc} @@ -83,7 +83,7 @@ %</driver> % \fi % -% \CheckSum{1132} +% \CheckSum{1141} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -102,44 +102,52 @@ % Right brace \} Tilde \~} % % \changes{v0.0}{2010/09/01}{Initial personal version} -% \changes{v0.9}{2020/01/02}{Initial documentation in french} -% \changes{v1.0}{2020/07/22}{Initial public version with documentation in english} +% \changes{v0.9}{2020/01/02}{Initial documentation in French} +% \changes{v1.0}{2020/07/22}{Initial public version with documentation in English} % \changes{v1.1}{2021/08/30}{ -% Macro tablenum (also used by siunitx) replaced by tablenum1, -% small modifications due to changes in tasks package} +% - macro tablenum (also used by siunitx) is replaced by tablenum1, +% - small modifications due to changes in the tasks package} % % \changes{v1.2}{2021/09/18}{ -% Bug correction in macros tablenum1 and tablenuma, -% using the translations package for internationalization} +% - bug correction in the tablenum1 and tablenuma macros, +% - using the translations package for internationalization} % % \changes{v1.3}{2021/11/15}{ -% Bad spacing in the exe macro and bug correction in the starred version of this macro} +% - bad spacing in the exe macro and bug correction in the starred version of this macro} % % \changes{v2.0}{2022/12/28}{ -% options toc and setlist with kvoptions (instead of notoc and nosetlist), -% introducing the key 'output' instead of old commands questionsonly, answersonly, -% introducing the key 'display' instead of old command displaypts, displaypoints, +% - options 'toc' and 'setlist' with kvoptions (instead of notoc and nosetlist), +% - introducing the 'output' key instead of the old commands questionsonly, answersonly, +% - introducing the 'display' key instead of the old commands displaypts, displaypoints, % displaynotes, -% introducing the keys 'margin' and 'noteragged' to set how the notes are displayed, -% introducing the key 'correct'} +% - introducing the 'margin' and 'noteragged' keys, to set how the notes are displayed, +% - introducing the 'correct' key} % \changes{v2.0}{2023/01/02}{ -% documentation update, -% new option checkpts} +% - documentation update, +% - new option 'checkpts'} % \changes{v2.0}{2023/01/09}{ -% new option 'marginwidth', -% modifying hmarginratio from 5:1 to 3:1 when display=notes, -% correct management of two side mode documents} +% - new option 'marginwidth', +% - modifying hmarginratio from 5:1 to 3:1 when 'display=notes', +% - correct management of two-sided mode documents} % \changes{v2.0}{2023/01/16}{ -% \enskip between titles and their optional argument, -% simplifying macros markingstyle and notestyle, -% use of ragged2e package, -% code revision and simplification, -% documentation update} +% - \enskip between titles and their optional argument, +% - simplifying the macros markingstyle and notestyle, +% - use of the ragged2e package, +% - code revision and simplification, +% - documentation update} % % \changes{v2.1}{2023/07/30}{ -% new environments tablenuma* and tablitem*} +% - new starred environments tablenuma* and tablitem*} % \changes{v2.1}{2023/08/24}{ -% English correction in the documentation} +% - English corrections in the documentation} +% +% \changes{v2.2}{2023/09/02}{ +% - correction of a color bug in the answer macro and the answers* environment +% - additional remark about the use of answers environments} +% \changes{v2.2}{2023/09/04}{ +% - new commands, labelenumone and labelenuma, allowing for global changes to +% tasks environments +% - the answerspace option is set to false when answers are displayed} % % \GetFileInfo{exesheet.dtx} % @@ -162,12 +170,12 @@ % In contrast, \textsf{exesheet} starts each exercise with |\exercise|, % which functions similarly to a subsection (with the same features) % and is suitable for documents that primarily consist of exercises. -% The package also offers alternative formatting, -% which is more suitable for shorter exercises. +% The package also offers alternative ways to introduce exercises, +% which are more appropriate for shorter exercises. % % Another distinctive feature of the \textsf{exesheet} package is its specific settings % for enumeration lists, which are -% useful for numbering questions or answers within an exercise. +% suitable for numbering questions or answers within an exercise. % % While other packages often offer more or less complex mechanisms % for managing the placement of answers, @@ -185,9 +193,8 @@ % % Many settings can be customized, and various options are available % to manage the output document. -% These options rely on the key-val mechanism: \texttt{key=value} -% (thanks to Maxime Chupin and Denis Bitouzé for suggesting this idea to improve this package). -% These options can be applied to the class or the package, \eg +% These options rely on the key-val mechanism: \texttt{key=value}. +% These options can be applied when calling the class or the package, \eg % \begin{center} % |\documentclass[a4paper,11pt,output=answers,display=pts]{exesheet}| % \end{center} @@ -204,9 +211,9 @@ % \subsection{The \texttt{\bs exercise} command} % % \DescribeMacro{\exercise} -% Each exercise starts with the |\exercise|\oarg{opt} command. -% This command typesets \textbf{\exercisename}, as a document -% subsection, followed by automatic numbering +% The |\exercise|\oarg{opt} command initiates an exercise with the title +% \textbf{\exercisename}, typeset as a document +% subsection, followed by automatic numbering, % unique to the entire document. % The optional parameter \meta{opt} is utilized to include additional text % on the same title line, such as specifying a subject or a marking scheme. @@ -214,11 +221,11 @@ % % \exercise[(to begin)] % \psframe(-0.25,1.3)(12.75,-0.3) -% Give this initial command a try; it's straightforward. +% Try this first command; easy! % % \bigskip -% To bring additional text closer to the exercise number, -% we can employ |\unskip| which removes any preceding space. +% To bring optional text closer to the exercise number, +% you can employ |\unskip| which removes any preceding space. % Take a look at the following example, achieved with % |\exercise[\unskip*** (difficult)]|: % \exercise[\unskip*** (difficult)] @@ -257,7 +264,7 @@ % for exercise titles. In this document, we have set the following in the preamble: % |\renewcommand{\labelexercisestyle}{\rmfamily\color{black}}| % \footnote{In this document, real section and subsection titles have been highlighted by -% modifying their color and font using the +% modifying their color and font (sans serif) using the % \texttt{\bs allsectionsfont} macro from the \textsf{sectsty} package.}. % % \medskip @@ -322,7 +329,8 @@ % % \bigskip % \DescribeMacro{\annexname} -% The term ``\annexname'' is automatically translated into several languages. +% The term ``\annexname'' is automatically translated into several languages +% (depending on the chosen language). % It can be extended to additional languages or altered by redefining |\annexname| % or by utilizing macros from the \textsf{translations} package. % @@ -376,26 +384,14 @@ % % \subsection{List settings} \label{setlist} % \DescribeEnv{enumerate} \DescribeMacro{\item} -% Enumeration lists are designed to represent questions and sub-questions +% Enumeration lists are used to represent questions and sub-questions % within exercises. To provide clear emphasis, % labels are formatted in bold. % Additionally, these labels are aligned to the left, positioned at the start of the line % without indentation, and the vertical spacing between items % is increased compared to standard \LaTeX{} lists. -% These formatting adjustments are achieved using the |\setlist| command -% \footnote{Labels can also be modified by providing an optional argument, -% \eg \texttt{\bs begin\{enumerate\}[A.]}, -% or globally through the use of \texttt{\bs labelenumi} -% and \texttt{\bs labelenumii} commands.}, +% These formatting adjustments are achieved using the |\setlist| command, % a feature from the \textsf{enumitem} package by Javier Bezos. -% Lists created with the \texttt{itemize} environment retain their default -% configuration -% \footnote{The \texttt{french} option of the \textsf{babel} package -% changes the behavior of \texttt{itemize} lists and employs long dashes -% as labels for each list level. -% This behavior can cause issues when mathematical content follows the dash -% symbol, as it might be mistaken for the minus sign. -% The default \texttt{itemize} list style is reinstated to address this concern.}. % % \vspace{-\baselineskip} % \noindent\psframe(-0.25,-0.35)(12.75,-3.9) @@ -410,10 +406,35 @@ % \end{enumerate} % % \smallskip +% The \texttt{enumerate} environment takes an optional parameter, +% that allows, among others things, +% the typesetting of alternative list labels. For instance, typing +% |\begin{enumerate}[label=\alph*),font=\itshape\normalfont]| +% will yield the labels ``\emph{a)}, \emph{b)}, \emph{c)}\ldots''. +% There are many other options available +% (see the \textsf{enumitem} package documentation) +% \footnote{Labels can also be modified using a ``shortlabel'' argument, +% \eg \texttt{\bs begin\{enumerate\}[A.]}, +% or globally through the redefinition of \texttt{\bs labelenumi} +% or \texttt{\bs labelenumii} commands.}. +% You can change global label font formatting using the syntax +% |\setlist[enumerate]{font=...}| +% (called \emph{after} |\begin{document}|). +% +% Lists created with the \texttt{itemize} environment retain their default +% configuration +% \footnote{The \texttt{french} option of the \textsf{babel} package +% changes the behavior of \texttt{itemize} lists and employs long dashes +% as labels for each list level. +% This behavior can cause issues when mathematical content follows the dash +% symbol, as it might be mistaken for the minus sign. +% Thus the default \texttt{itemize} list style is reinstated.}. +% +% \medskip % \DescribeMacro{[setlist=\meta{bool}]} -% To prevent changes to enumeration lists and revert to the default \LaTeX{} -% settings, you can utilize the package option |setlist=false| -% (with the default value being \texttt{true} of course). +% The package option |setlist=false| prevents changes to enumeration and itemize lists +% and reverts to the default \LaTeX{} settings +% (the default value is \texttt{true}). % % \subsection{List of exercises : the \texttt{exenumerate} environment} % \DescribeEnv{exenumerate} @@ -426,8 +447,7 @@ % Here is an example (the main list uses the \texttt{exenumerate} environment, while the % sub-list is created using the standard \texttt{enumerate} environment): % -% \pagebreak -% ^^A \vspace{-\baselineskip} +% \vspace{-\baselineskip} % \noindent\psframe(-0.25,-0.3)(12.75,-6) % \begin{exenumerate} % \item Translate the following sentences in English: @@ -443,13 +463,10 @@ % et magnis dis parturient montes, nascetur ridiculus mus. % \end{exenumerate} % -% \medskip -% The environment takes an optional parameter, similar to \texttt{enumerate}, -% that allows, among others things, -% the typesetting of alternative list labels, \eg -% |\begin{exenumerate}[A.]|. -% There are numerous other options available -% (refer to the \textsf{enumitem} package documentation for details). +% \smallskip +% The \texttt{exenumerate} environment (also based on the \textsf{enumitem} package) +% accepts an optional parameter, +% similar to the \texttt{enumerate} environment. % % \subsection{Items aligned by row: \texttt{tablenum1}, \texttt{tablenuma}, \texttt{tablitem}} % \DescribeEnv{tablenum1} @@ -464,11 +481,12 @@ % This parameter can be omitted, in which case its default value is 2. % Similar to conventional lists, each item is initiated with the |\item| command. % -% These three environments are defined using the +% \smallskip +% Internally we have utilized the % |\NewTasksEnvironment| macro from the \textsf{tasks} package by Clemens Niederberger. -% They accept an optional argument \meta{opt}, which is +% The usage of the optional argument \meta{opt} is % explained in the documentation of this package. -% For example, similar to the \texttt{enumitem} package, +% For example, similar to the \textsf{enumitem} package, % |label=\arabic*)| produces an Arabic numbering % followed by a closing parenthesis. % Additionally there are numerous possibilities for arranging items in original ways. @@ -477,11 +495,11 @@ % In the subsequent example, % the five |\item| commands are sequentially positioned between % |\begin{tablenum1}(3)| and |\end{tablenum1}|. -% It's important to notice that numbering occurs line by line in this context. +% Notice that numbering occurs line by line in this context. % % \exercise % \psframe(-0.25,1.3)(12.75,-2.8) -% Provide the derivative of the following functions: +% Calculate the derivative of the following functions: % \begin{tablenum1}(3) % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$, % \item $\ds g(x) = \ln \left( \frac{1-x}{1+x^2}\right)$, @@ -490,14 +508,23 @@ % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$. % \end{tablenum1} % +% ^^A \smallskip +% For \texttt{tablenuma}, labels are letters, a, b, c, \ldots, enclosed in parentheses. +% +% \DescribeMacro{\labelenumone}\DescribeMacro{\labelenuma} +% You can change the labels by redefining the macros |\labelenumone| +% (for \texttt{tablenum1}) and |\labelenuma| (for \texttt{tablenuma}), +% using the \texttt{task} counter, +% \eg |\renewcommand\labelenuma{\Alph{task}.}| yields the labels \textbf{A.}, \textbf{B.}, \ldots +% % \smallskip -% For \texttt{tablenuma}, labels are -% letters (a, b, c, \ldots) enclosed in -% parentheses. This cannot be globally altered, -% except by redefining the environment using |\RenewTasksEnvironment|. % If the \textsf{exesheet} package is invoked with the option \texttt{setlist=false}, % labels within \texttt{tablenum1} and \texttt{tablenuma} environments -% will be presented with indentation and in regular font rather than bold. +% will be presented with indentation and in normal font rather than bold. +% You can change the label formatting globally with the command |\settask|, \eg +% |\settask{label-format=\itshape}|. +% You can also completely redefine the environments using |\RenewTasksEnvironment|. +% When \texttt{setlist=true}, place these commands \emph{after} |\begin{document}|. % % \medskip % \DescribeEnv{tablenuma*} \DescribeEnv{tablitem*} @@ -514,16 +541,16 @@ % the starred environments \texttt{tablenuma*} and \texttt{tablitem*}, % with corrected alignment as shown below: % -% \noindent\psframe(-0.25,0.05)(12.75,-1) -% \psline[linewidth=0.1pt,linecolor=green,linestyle=dashed](0, -0.63)(10.5, -0.63) +% \noindent\psframe(-0.25,0.05)(12.75,-0.9) +% \psline[linewidth=0.1pt,linecolor=green,linestyle=dashed](0, -0.57)(10.5, -0.57) % \begin{enumerate} % \item % \begin{tablenuma*}(3) \item One \item Two \item Three \end{tablenuma*} % \end{enumerate} % % \medskip -% If the vertical alignment is still not optimal, include -% |\mbox{}\vspace|\marg{height} just before invoking |\begin{tablenuma*}| +% If the vertical alignment is still not perfect, include +% |\mbox{}\vspace|\marg{height} just after |\item| and before invoking |\begin{tablenuma*}| % (or |\begin{tablitem*}|), where \meta{height} can be a positive or negative length. % % \subsection{Items aligned by column: \texttt{colsenum}, \texttt{colsitem}} @@ -532,7 +559,7 @@ % \texttt{colsenum} environment is available: % |\begin{colsenum}|\oarg{opt}\marg{cols}. % The mandatory parameter is the number of columns, -% and the optional parameter will be passed to the \texttt{enumerate} environment, +% and the optional parameter will be passed to the underlying \texttt{enumerate} environment, % allowing you to change the numbering type (\eg a, A, etc.), among other possibilities. % To use this environment, you need to load the % \textsf{multicol} package in the preamble. @@ -540,7 +567,7 @@ % % \exercise % \psframe(-0.25,1.3)(12.75,-2.65) -% Provide the derivative of the following functions: +% Calculate the derivative of the following functions: % \begin{colsenum}{3} % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$, % \item $\ds g(x) = \ln \left( \frac{1-x}{1+x^2}\right)$, @@ -553,17 +580,17 @@ % \DescribeEnv{colsenum*} % We will observe that, on each line, items are not necessarily properly % aligned, which can result in ungraceful effects. -% On the other hand the \texttt{colsenum} environment doesn't attempt to align columns -% from the bottom by adjusting the spacing between items. +% On the other hand, the \texttt{colsenum} environment doesn't attempt to align columns +% from the bottom by adjusting the vertical spacing between items. % If we desire this alignment % (which is the default behavior in \textsf{multicol}), we can use the % \texttt{colsenum*} environment (with the same syntax as \texttt{colsenum}). -% Here's what we obtain with \texttt{colsenum*}, using the same exercise: +% Here's what we obtain with \texttt{colsenum*}: % % \pagebreak % \exercise % \psframe(-0.25,1.3)(12.75,-2.65) -% Provide the derivative of the following functions: +% Calculate the derivative of the following functions: % \begin{colsenum*}{3} % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$, % \item $\ds g(x) = \ln \left( \frac{1-x}{1+x^2}\right)$, @@ -578,7 +605,7 @@ % might still be more suitable when dealing with numerous items of varying heights, % and especially when the number of items can differ from column to column. % Additionally, a benefit of \texttt{colsenum} is that the label selection -% is automatic based on the list level (and the language), +% is automatic, based on the list level (and the language), % unlike \texttt{tablenum1} or \texttt{tablenuma}. % % \bigskip @@ -586,7 +613,7 @@ % \DescribeEnv{colsitem*} % For \texttt{itemize} lists, the \texttt{colsitem} environment % generates items aligned by column, unlike the line-by-line alignment of -% \texttt{tablitem}. To use it, simply employ +% \texttt{tablitem}. It follows the same syntax as \texttt{colsenum}: % |\begin{colsitem}|\oarg{opt}\marg{cols}. The optional parameter, % passed to the underlying \texttt{itemize} environment, % permits the modification of the item label (bullet by default). @@ -636,7 +663,7 @@ % % \pagebreak % ^^A \vspace{-\baselineskip} -% \noindent\psframe(-0.25,-0.25)(12.75,-6.9) +% \noindent\psframe(-0.25,-0.25)(12.75,-7.1) % \exercise % \begin{questions} % \begin{enumerate} @@ -663,28 +690,27 @@ % When only answers are displayed, the text color remains black and % the word ``\correctionname'' is not displayed. % -% \subsection{About the title ``\correctionname'' in \texttt{answers} environments} +% \subsection{More about \texttt{answers} environments} % Internally, we have utilized the |\comment| and |\endcomment| macros % from the \textsf{versions} package by Uwe Lück. -% Several other outstanding packages also enable selective management of code portions. -% Notably, the \textsf{verbatim} package by Rainer Schöpf, -% \textsf{comment} by Victor Eijkhout, -% \textsf{version} by Donald Arseneau and Stephen Bellantoni, -% \textsf{optional} by Donald Arseneau -% and \textsf{codesection} by Matthias Pospiech. -% -% Moreover the \textsf{versions} package includes -% the |\includeversion|\marg{env} and -% |\excludeversion|\marg{env} macros which allow for the inclusion or exclusion of +% ^^A Several other packages also enable selective management of code portions. +% ^^A Notably, the \textsf{verbatim} package by Rainer Schöpf, +% ^^A \textsf{comment} by Victor Eijkhout, +% ^^A \textsf{version} by Donald Arseneau and Stephen Bellantoni, +% ^^A \textsf{optional} by Donald Arseneau +% ^^A and \textsf{codesection} by Matthias Pospiech. +% Moreover, the \textsf{versions} package offers +% the |\excludeversion|\marg{env} and +% |\includeversion|\marg{env} macros which allow for the exclusion or inclusion of % any environment \meta{env}. These ``optional'' environments -% can be nested -% \footnote{The \textsf{codesection} package also supports -% such nesting, including within the preamble, as well as -% the \textsf{optional} package, but the latter manages only short sections of optional code.}. +% can be nested. +% ^^A \footnote{The \textsf{codesection} package also supports +% ^^A such nesting, including within the preamble, as well as the \textsf{optional} package, +% ^^A but the latter manages only short sections of optional code.}. % % However the \texttt{questions} and \texttt{answers} environments % serve a broader purpose beyond merely displaying or hiding text. -% For instance, you can choose to have a single answers environment +% You can choose to have a single answers environment % for the entire sheet, or alternatively, have separate answers environments % for each exercise, exercise part, question, or sub-question. % The format in which the title \textbf{\correctionname} should appear @@ -695,21 +721,27 @@ % % \medskip % \DescribeEnv{answers\oarg{level}} -% However, there are perhaps twisted situations in which -% the title level may not always be accurate. -% Furthermore, users might wish to adjust the title's level themselves. +% However, users might wish to adjust the title's level themselves. % To achieve this, you can manually set the level of the title ``\correctionname'' -% using |\begin{answers}|\oarg{level}. -% The optional \meta{level} parameter is defined as follows: +% using an optional \meta{level} argument which is defined as follows: % 1 for section-level titles, -% 2 for subsections (akin \textbf{\exercisename}), +% 2 for subsections (akin to \textbf{\exercisename}), % 3 for sub-subsections (similar to \textbf{\partname}), % other numbers for lower levels % (which won't appear in the table of contents or in the PDF file’s summary). % -% \smallskip +% Caution should be taken that, if the \texttt{questions} environment is not used +% beforehand in the same exercise (or part), +% the \texttt{answers} environment will consider the correction as global +% for the entire sheet (or exercise) and will reset the \texttt{exercise} +% (or \texttt{part}) counter. +% This can be managed properly with the optional argument. +% For example, use |\begin{answers}[2]| to prevent \texttt{exercise} counter reset, +% or |\begin{answers}[3]| to prevent \texttt{subpart} counter reset. +% +% \medskip % \DescribeMacro{answers*} -% The starred version \texttt{answers*}, completely hides the +% The starred version \texttt{answers*} doesn't display the % \textbf{\correctionname} title. % % \subsection{Commands \texttt{\bs question}, \texttt{\bs answer} and \texttt{\bs answerspace}} @@ -723,7 +755,7 @@ % you wish to display the answer immediately after each question item. % The title ``\correctionname'' won't appear at the start % of each answer with the |\answer| macro. -% The answers are formatted using |\correctionstyle| +% The answers are also formatted using |\correctionstyle| % if \texttt{output=both}. % However these commands do not support \texttt{verbatim} text within them, % unlike the \texttt{questions} and \texttt{answers} environments which do. @@ -744,20 +776,22 @@ % or hidden, controlled by the % \texttt{answerspace} option key, which can be set to either % \texttt{true} or \texttt{false} (the default). +% The \texttt{answerspace} key option has no effect (equivalent to \texttt{false}) +% when the answers are displayed (\texttt{output=answers} or \texttt{both}). % Of course the |\answerspace| macro is not meant to be used within \texttt{answers} % environments. % % \section{Marginal notes for marking scheme} % % The \textsf{exesheet} package enables the display of a detailed marking -% scheme in the margins, along with comments and explanations about answers. +% scheme in the margins, along with optional comments and explanations about answers. % % \subsection{The \texttt{\bs points} command}\label{points} % \DescribeMacro{\points} % The |\points|\marg{pts} command displays the number of points awarded for an exercise. % It is intended to be included in the optional argument of the % |\exercise| command -% \footnote{However using this command in the optional argument of +% \footnote{However using \texttt{\bs points} in the optional argument of % \texttt{\bs exercise} is not compatible with % the \textsf{memoir} class, as the \textsf{memoir} class redefines section commands.}. % In the following example, we used @@ -769,14 +803,14 @@ % \bigskip % When only the correction is displayed in an exercise, the |\points| macro doesn't % show the points. -% A more comprehensive solution for printing answers along with the point scale -% will be presented +% Printing answers along with the point scale +% will be discussed % in section \ref{totalpoints}, which includes another |\totalpoints| macro. % % \bigskip % \DescribeMacro{\pointsname} \DescribeMacro{\pointname} % The term ``\pointsname'' (or ``\pointname'' in the singular -% if \meta{pts} is less than 2), is appended and +% if \meta{pts} is less than 2) is appended and % is automatically translated into several languages % (and can also be modified). % @@ -831,7 +865,7 @@ % % For a two-sided document, the default behavior is to place text in the outer margin, % which is wider than the inner margin (that contains the binding). -% The outer margin aligns with the right side on odd pages and with the left side +% The outer margin is positioned on the right side on odd pages and on the left side % on even pages. Therefore, the \texttt{marginpos} option can also take the % values \texttt{inner} or \texttt{outer}. % If you specify \texttt{left} or \texttt{right} when the \texttt{twoside} mode is activated, @@ -960,7 +994,7 @@ % \DescribeMacro{notecolor} \DescribeMacro{\notestyle} % By default, comment notes are typeset in a dark green color % defined by |\definecolor{notecolor}{rgb}{0.0,0.4,0.0}|. -% The style of the comment is determined by the |\notestyle| macro. +% The style of comments is determined by the |\notestyle| macro. % % \subsection{Margin notes options} \label{margin} % @@ -1031,7 +1065,7 @@ % \texttt{left}, \texttt{right}, \texttt{center}, \texttt{justify} or \texttt{twoside}. % The default value is \texttt{noteragged=left}, resulting in right-aligned text, % which is common for text in the left margin. -% When \texttt{noteragged=right}, the text is left-aligned text. +% When \texttt{noteragged=right}, the text is left-aligned. % Using \texttt{justify} makes the text justified, aligning with % \LaTeX's default behavior for marginal notes. % Finally \texttt{noteragged=twoside} aligns text to the left on odd pages @@ -1050,15 +1084,15 @@ % When the scale isn't visible, % it functions similarly to |\points|, and when the scale is shown, % it's akin to |\totalexe|. -% For instance, in the exercise \ref{totalexe}, it's preferable to use -% |\totalpoints| instead of |\totalexe|, -% as when the detailed marking scheme isn't displayed, the total points will be typeset -% in a manner similar to exercise \ref{points} rather than in the margin. +% For instance, in exercise \ref{totalexe}, we could have used |\totalpoints| +% instead of |\totalexe|. In this case, +% when the detailed marking scheme is not displayed, the total points would be presented +% similarly to exercise \ref{points} rather than being absent. % % \subsection{Marking scheme consistency checking}\label{scale} % % \DescribeMacro{[checkpts=\meta{bool}]} -% The marking scheme can be checked +% The marking scheme can be checked out % \footnote{Thanks to Denis Bitouzé for his suggestion about this feature.} % using the key-val option \texttt{checkpts=true}; % the default value is \texttt{false}. @@ -1123,9 +1157,9 @@ % \end{center} % % When an invalid key is provided, an error is generated. However, -% if a value is not recognized, a warning message will appear:\\ -% \texttt{Value `\meta{value}'\ is not supported by `\meta{key}' option -% on input line \ldots} \\ +% an unrecognized value only triggers a warning message: +% \centeredline{\texttt{Value ... is not supported by ... option +% on input line \ldots}} % For each option, you can set them through the class or package invocation, \eg % |\usepackage[output=answers,display=notes,noteragged=right]{exesheet}| % @@ -1138,7 +1172,7 @@ % can be changed dynamically, even within the document, % while the others are applicable in the preamble exclusively. % Dynamic options are processed with each call, whereas the others are processed once, -% when the document begins. +% at |\begin{document}|. % \hypertarget{correct}{} % % \bigskip @@ -1147,16 +1181,16 @@ % \emph{class} or in conjunction with the \textsf{schooldocs} package. % This option adds ``\correctname'' (or its translation) % to the document title and headers. -% Possible values are: \texttt{true}, \texttt{false} (default) or \texttt{conditional}. -% When set to \texttt{correct=conditional}, it behaves as \texttt{true} +% Possible values are: \texttt{true}, \texttt{false} (by default) or \texttt{conditional}. +% Using \texttt{correct=conditional}, it behaves as \texttt{true} % when answers are displayed and \texttt{false} when they're not. % % \subsection{Alternative (deprecated) commands} % % Prior to version 2.0, we used specialized commands to configure % output and display options. -% Thanks to a suggestion from Maxime Chupin, we have now implemented \emph{key=value} -% options in the package. +% Thanks to a suggestion from Maxime Chupin and Denis Bitouzé, +% we have now implemented \emph{key=value} options. % Although the latter is more user-friendly, % the older commands are still supported for compatibility reasons and are outlined here. % While these commands will trigger a warning message, they remain functional. @@ -1207,19 +1241,19 @@ %</class> % \end{macrocode} % -% Options are established using the \textsf{kvoptions} package (build on \textsf{keyval}). -% String options are managed through distinct macros -% that are defined in their respective sections. +% Options are defined using the \textsf{kvoptions} package. +% String options are managed through distinct processing macros +% that are implemented in their respective sections. % For options whose effects cannot be dynamically altered -% and must be configured in the preamble, they are processed once -% upon the start of the document. -% The other options are executed upon package loading +% and must be configured in the preamble, they are processed once, +% at |\begin{document}|. +% The other options are executed when this package is loaded % (at the end of the package, as |\exs@process...| % commands are not recognized at the outset). % -% A distinct case emerges with \texttt{setlist} when utilized in conjunction with +% A distinct case is to mention with \texttt{setlist} when utilized in conjunction with % \textsf{babel-french}. -% In this instance, it is processed immediately and subsequently disabled +% In this instance, this option is processed immediately and subsequently disabled % (further clarification follows below). % % \begin{macrocode} @@ -1244,7 +1278,7 @@ \exs@process@output \exs@process@display \exs@process@noteragged -} +} % answerspace do not need a special process macro \AtEndOfPackage{\exs@process@dynoptions} \AtBeginDocument{ @@ -1304,7 +1338,8 @@ % as loaded by \textsf{babel} or \textsf{polyglossia}. % % Accented characters cannot be utilized here, as they might not be recognized -% if \textsf{inputenc} is loaded after \textsf{exesheet}. +% if \textsf{exesheet} is loaded before any other package +% (typically when it is loaded as a class). % As a workaround, we rely on basic \LaTeX{} control sequences to generate them. % % \begin{macrocode} @@ -1399,7 +1434,7 @@ % include the following code in the preamble \\ % |\makeatletter \@addtoreset{exercise}{section} \makeatother|. % -% The parts counter depends on the \texttt{exercise} counter and is reset +% The parts counter (\texttt{subpart}) depends on the \texttt{exercise} counter and is reset % with each new exercise. % % The commands |\labelexercisestyle| and |\labelsubpartstyle| @@ -1422,7 +1457,7 @@ \newcommand{\labelexercisestyle}{} \newcommand*{\@exercise}[1][]{% \ifexesheet@checkpts \exe@check{\labelexercise} \fi - % curiously, the \execheck must be performed before \refstepcounter ! + % curiously, \exe@check must be performed before \refstepcounter \refstepcounter{exercise} \subsection*{\labelexercisestyle\labelexercise\enskip #1} \ifexesheet@exetoc @@ -1513,7 +1548,7 @@ % These modifications are undone here to revert to the default % \LaTeX\ \texttt{itemize} lists, including labels and spaces. % We have created the |\standardfrenchlists| command, which should be invoked within the -% |AtBeginDocument| command, depending on whether +% |\AtBeginDocument| command, depending on whether % \textsf{exesheet} is loaded before or after \textsf{babel}. % \begin{macrocode} \newcommand\standardfrenchlists{% @@ -1522,10 +1557,14 @@ }{} } \ifexesheet@setlist - \standardfrenchlists % necessary when exesheet is loaded after babel + \standardfrenchlists + % must be executed here when exesheet is loaded after babel \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{setlist} \fi +\newcommand\labelenumone{\arabic{task}.} +\newcommand\labelenuma{(\alph{task})} + \def\exs@process@setlist{% must be executed at begin document \ifexesheet@setlist \standardfrenchlists % if exesheet is loaded before babel @@ -1542,19 +1581,21 @@ % items in other \texttt{enumerate} (or \texttt{itemize}) environments. % \begin{macrocode} \ifexesheet@setlist - \NewTasksEnvironment[label=\arabic*.,label-format=\bfseries, + \settasks{label-format=\bfseries} + \NewTasksEnvironment[label=\labelenumone, column-sep=1em,label-align=right, item-indent=1.5em,label-width=1em,label-offset=0.5em, after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2) - \NewTasksEnvironment[label=(\alph*),label-format=\bfseries, + \NewTasksEnvironment[label=\labelenuma, column-sep=1em,label-align=right, item-indent=2.15em,label-width=1.6em,label-offset=0.5em, after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2) \else - \NewTasksEnvironment[label=\arabic*., - column-sep=1em, + \NewTasksEnvironment[label=\labelenumone, + column-sep=1em,label-align=right, + label-width=1em,label-offset=0.5em, after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2) - \NewTasksEnvironment[label=(\alph*), + \NewTasksEnvironment[label=\labelenuma, column-sep=1em,label-align=right, item-indent=2.15em,label-width=1.6em,label-offset=0.5em, after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2) @@ -1566,7 +1607,7 @@ % \begin{macrocode} \NewTasksEnvironment[label=\labelitemi, label-align=right, - item-indent=2.3333em,label-offset=0.5em, + item-indent=2.5em,label-offset=0.5em, after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablitem}[\item](2) % \end{macrocode} @@ -1576,7 +1617,7 @@ % precisely at the outset of an |\item|, in order to achieve correct horizontal % alignment. % The length of |-1.667\baselineskip| has been tested with various font families and sizes. -% It functions properly. +% The alignment is generally good. % \begin{macrocode} \newenvironment{tablenuma*}{% \mbox{}\vspace{-1.667\baselineskip}\begin{tablenuma}}{ @@ -1656,10 +1697,12 @@ \ifthenelse{\equal{\exesheet@output}{answers}}{ \setboolean{exesheet@questions}{false} \setboolean{exesheet@answers}{true} + \exesheet@answerspacefalse }{% else if \ifthenelse{\equal{\exesheet@output}{both}}{ \setboolean{exesheet@questions}{true} \setboolean{exesheet@answers}{true} + \exesheet@answerspacefalse }{% else \PackageWarning{exesheet}{Value `\exesheet@output' is not supported by `output' option} @@ -1679,7 +1722,7 @@ % and |\EndCodeSection|\marg{skip} macros, % both in the text body and the preamble. % However, these macros cannot be used within an environment -% as we've done here with |\comment| and |\endcomment|. +% as we have done here with |\comment| and |\endcomment|. % Several of our tests use the \LaTeX{} syntax |\ifthenelse{\bolean{...}}| % since |\comment| and |\endcomment| can sometimes interfere % with the \TeX\ structure |\if| \ldots |\else| \ldots |\fi|. @@ -1774,7 +1817,7 @@ }{\ifthenelse{\boolean{exesheet@answers}}{}{\endcomment}} \newenvironment{answers*}{ - \ifthenelse{\boolean{exesheet@answers}}{}{\comment} + \ifthenelse{\boolean{exesheet@answers}}{\correctionstyle}{\comment} }{\ifthenelse{\boolean{exesheet@answers}}{}{\endcomment}} % \end{macrocode} @@ -1793,7 +1836,7 @@ % \begin{macrocode} \newcommand{\answer}[1]{% \ifexesheet@answers% - \ifexesheet@questions \correctionstyle #1\else #1\fi + \ifexesheet@questions {\correctionstyle #1}\else #1\fi \fi } @@ -1900,7 +1943,7 @@ % The \texttt{marginwidth} option adjusts the ratio between left and right margins % based on what needs to be displayed in the margin (points only or full notes) % \footnote{To ensure the accurate effect on the margin ratio, this option is processed -% at beginning of the document, after other commands +% at the beginning of the document, after other commands % that could potentially alter the page geometry.}. % % When \texttt{display=notes}, the additional length of \texttt{1\,in} corresponds to @@ -1988,9 +2031,9 @@ % \end{macrocode} % \end{macro} -% For a two-sided document, the \textsf{geometry} package doe not correctly set +% For a two-sided document, the \textsf{geometry} package does not correctly set % the width of the margin paragraph by default; it's too wide. -% Therefore we provide an explicit setting here, which is +% Therefore, we provide an explicit setting here, which is % useful when \texttt{marginwidth=unset}. Otherwise, the setting is % handled by the \texttt{marginwidth} key option. % @@ -2065,7 +2108,7 @@ % \begin{macro}{\exs@process@checkpts} % The scale control option relies on calculations with \emph{lengths}, % which need to have a \emph{global} scope. -% To achieve this, we employ the macros |\gsetlength| and |\gaddtolength|. +% To achieve this, we first define the macros |\gsetlength| and |\gaddtolength|. % These macros include \% symbols at the end of lines to avoid expanded blank % spaces. % @@ -2166,7 +2209,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Margin notes commands} +% \subsection{Marginal notes commands} % % \begin{macro}{\points} % \begin{macrocode} diff --git a/macros/latex/contrib/exesheet/exesheet.pdf b/macros/latex/contrib/exesheet/exesheet.pdf Binary files differindex 87adb6ee65..f9845a9ce1 100644 --- a/macros/latex/contrib/exesheet/exesheet.pdf +++ b/macros/latex/contrib/exesheet/exesheet.pdf diff --git a/macros/latex/contrib/fitch/README.md b/macros/latex/contrib/fitch/README.md new file mode 100644 index 0000000000..1208f4f2dd --- /dev/null +++ b/macros/latex/contrib/fitch/README.md @@ -0,0 +1,82 @@ +# fitch.sty + +LaTeX macros for Fitch style natural deduction + +## Usage + +Fitch-style natural deduction is a system for writing proofs in +propositional logic and predicate logic. This is a set of easy-to-use +LaTeX macros originally written by Peter Selinger. It is used, e.g., +in the various versions of _forall x_ by PD Magnus (e.g., the [original](https://www.fecundity.com/logic/download.html), +[Cambridge](http://www.homepages.ucl.ac.uk/~uctytbu/OERs.html), and [Calgary](https://forallx.openlogicproject.org) versions) + +With these macros, one can typeset natural deduction proofs in Fitch +style, as in the following example: + +![](fitchexample.png) + +``` +\begin{nd} + \hypo {1} {\forall y \neg P(y)} + \open + \hypo {2} {\exists x P(x)} + \open[u] + \hypo {3} {P(u)} + \have {4}{\forall y \neg P(y)} \r{1} + \have {5} {\neg P(u)} \Ae{4} + \have {6} {\bot} \ne{3,5} + \close + \have {6a} {\bot} \Ee{2,3-6} + \close + \have {7} {\neg \exists x P(x)} \ni{2-6a} +\end{nd} +``` + +The output is shown above, and the corresponding LaTeX code below. + +## Changes + +**v0.6, Sept 4, 2023.** Updated the documentation and license (from +GPL to LPPL). The code is essentially unchanged. + +**v0.5, Feb 8, 2005.** The ability to handle multi-line formulas +was added. + +## Download + +The package is available on CTAN as +[`fitch`](https://ctan.org/pkg/fitch). + +The code is [maintained on Github](https://github.com/OpenLogicProject/fitch/). + +## Related packages + +- The [`lplfitch`](https://ctan.org/pkg/lplfitch) packages produces + Fitch-style roofs in the format used in Barwise & Etchemendy's textbook + _Language, Proof, and Logic_. +- The [`natded`](https://ctan.org/pkg/natded) package produces natural + deduction roofs in the style of Jaśkowski, or that of Kalish and + Montague. + +Additional packages for proofs, including Johan Klüwer's, are +available at a [page maintained by Alex Kocurek](https://www.actual.world/latex/) + +## People + +Peter Selinger, Dalhousie University, is the original author. + +Richard Zach, University of Calgary, it the current maintainer. + +## License + +Copyright (C) 2002-2023 Peter Selinger + +This work may be distributed and/or modified under the conditions of +the LaTeX Project Public License, either version 1.3 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.
\ No newline at end of file diff --git a/macros/latex/contrib/fitch/fitch.hacker.txt b/macros/latex/contrib/fitch/fitch.hacker.txt new file mode 100644 index 0000000000..df4af5c4da --- /dev/null +++ b/macros/latex/contrib/fitch/fitch.hacker.txt @@ -0,0 +1,314 @@ +This file describes the internals of the macros in fitch.sty. It is +intended for programmers who might want to hack this package. For +information on how to use the package, please see the user guide, +which is provided in the file fitchdoc.tex. + +GENERAL + +Global identifiers defined by this package start with '\nd*'. The only +exceptions are \ndref, \nddim, \ndindent, and the "nd" and "ndresume" +latex environments. + +The macros provided by this package mix TeX and LaTeX primitives. +LaTeX is used for \rule, \settowidth, \addtolength, \hspace... All +macros are assumed to be called in math mode. + +Translation proceeds through several layers of macros. Each layer +consist of macros which expand into macros of the previous layer. Each +layer may have some global state and initialization functions. Only +the topmost layer (layer D) is directly user-accessible. + +REFERENCES + +We start with some macros to facilitate automatic line numbering, and +for referencing of lines by labels. The macros defined here are: +\nd*reset to reset the line number count. \nd*num{x}, to generate the +next line number and store it in reference x; \nd*ref{x} to print the +line number referenced by x, \ndref{xxx} to parse a list of +references, separated by commas, periods, and hyphens, and translate +all references to line numbers. Note: \ndref ignores spaces in its +argument, but puts a space after each comma or period in the +output. Also note: \nd*ref can be useful outside a natded environment, +and thus it has a user accessible name. Most general ``line numbers'' +actually consist of a name (such as ``n'') and a number (such as +``2''), to produce output such as $n+2$. \nd*set{n}{m} is called to +set the letter to n and the number to m. As special cases, if the +second argument is empty, it is not set, and if the first argument is +\relax, it is not set. + +Example for references: + +\nd*reset \nd*num{x}; \nd*num{y}; \nd*numopt{n+1}{z}; \nd*num{zz}; +\nd*ref{y}; \ndref{x, y-zz, z} +will produce: 1; 2; n+1; 3; 2; 1, 2-3, n+1 + +LAYER A + +Layer A provides primitive picture elements which can be combined into +natural deduction derivations. These are: \nd*t to make a topmost +vertical line segment; \nd*v to make a continuation vertical line +segment, \nd*i to produce the indentation for a subproof, \nd*s to +produce the horizontal space between a vertical line and a formula, +\nd*u{x} to underline x with appropriate spacing for a +hypothesis. \nd*f{x} typesets the formula x with the appropriate +vertical spacing. \nd*g{x} is like \nd*i, except it puts a guard in +the space it creates. These elements are spaced so that they are +appropriate as left-aligned array entries. Line numberings and +justifications must be provided manually in this layer. All explicit +spacing information is contained in this layer; higher layers +manipulate only layer A primitives. + +Example of a derivation using layer A syntax: + +\[ +\begin{array}{lll} + 1 & \nd*t\nd*s\nd*f {P\vee Q} \\ + 2 & \nd*v\nd*s\nd*u {\neg Q} \\ + 3 & \nd*v\nd*i\nd*t\nd*s\nd*u {P} \\ + 4 & \nd*v\nd*i\nd*v\nd*s\nd*f {P} & \mbox{by 3} \\ + 5 & \nd*v\nd*i\nd*t\nd*s\nd*u {Q} \\ + 6 & \nd*v\nd*i\nd*v\nd*s\nd*f {\neg Q} & \mbox{by 2} \\ + 7 & \nd*v\nd*i\nd*v\nd*s\nd*f {\bot} & \mbox{by 5, 6} \\ + 8 & \nd*v\nd*i\nd*v\nd*s\nd*f {P} & \mbox{by 7} \\ + 9 & \nd*v\nd*s\nd*f {P} & \mbox{by 1, 3-4, 5-8} \\ +\end{array} +\] + +LISTS + +This is a bit of a hack. We implement linked lists as follows: a list +is either \nd*nil, or \nd*cons{T}{H}, where T is another list, and H +is some arbitrary code. Note that lists grow to the right. The +following macros operate on a list that is stored in a macro \list. + +\nd*push\list{item} pushes the item onto the list +\nd*pop\list{item} pops and discards the last item from the list +\nd*item\list{command} applies command to each element of the list +\nd*modify\list\n{elt} modifies the \n-th element of the +list, if there is such an element. Here \n is a counter. Elements +are counted from the right, starting from 1. + +We use lists of items of the forms \nd*t, \nd*v, \nd*i, and \nd*g{...} +to represent the current indentation level and format (see Layer A, +above). The function \nd*cont computes the indentation for the +following line by replacing all items of the form \nd*t by \nd*v and +\nd*g{...} by \nd*i. + +With the list syntax, a derivation can be expressed like this: + +\[ +\begin{array}{lll} + \gdef\stack{\nd*nil} + \newcount\n + \nd*push\stack{\nd*t} + 1 & \nd*iter\stack\relax\nd*s\nd*u {\neg\exists xP(x)} \\ + \nd*cont\stack + \nd*push\stack{\nd*i} + \nd*push\stack{\nd*t} + \nd*n=2\nd*modify\stack\n{\nd*g{u}} + \nd*push\stack{\nd*i} + \nd*push\stack{\nd*t} + 2 & \nd*iter\stack\relax\nd*s\nd*u {P(u)} \\ + \nd*cont\stack + 3 & \nd*iter\stack\relax\nd*s\nd*f {\exists xP(x)} \\ + \nd*cont\stack + 4 & \nd*iter\stack\relax\nd*s\nd*f {\neg\exists xP(x)} \\ + \nd*cont\stack + 5 & \nd*iter\stack\relax\nd*s\nd*f {\bot} \\ + \nd*cont\stack + \nd*pop\stack + \nd*pop\stack + 6 & \nd*iter\stack\relax\nd*s\nd*f {\neg P(u)} \\ + \nd*cont\stack + \nd*pop\stack + \nd*pop\stack + 7 & \nd*iter\stack\relax\nd*s\nd*f {\forall y\neg P(y)} \\ + \nd*cont\stack +\end{array} +\] + +LAYER B + +Layer B is simply a wrapper around layer A. It provides commands +\nd*beginb, \nd*resumeb, \nd*endb, \nd*openb, \nd*closeb, \nd*guardb, +\nd*hypob, and \nd*haveb which abstract from the layer A +primitives. This includes automatic line numbering, and automatic +indentation. \nd*hypocontb and \nd*havecontb are like \nd*hypob and +\nd*haveb, except that they introduce continuation lines that are +slightly indented and have no line number/label. \nd*beginb and +\nd*endb enclose a natural deduction in layer B syntax. \nd*resumeb is +like \nd*beginb, except that it resumes a deduction in progress (for +instance, after a manual page break). \nd*openb and \nd*closeb open, +respectively close, a subproof. \nd*guardb{n}{g} adds the guard g to +the nth enclosing subderivation (counted from 1 from the +inside). \nd*hypob introduces a hypothesis, and \nd*haveb introduces a +non-hypothesis line in a proof. Line numbering is integrated, but +justifications must still be given manually. Also, proof lines must +still be terminated by '\\'. An idiosyncracy of this layer is that in +a list of several hypotheses, all but the last one must be called with +\nd*haveb, not \nd*hypob, to avoid drawing a horizontal line under +each of them. + +Example of a derivation using layer B syntax. Note that the "line +numbers" are really labels, which will be replaced by consecutive line +numbers in the output. + +\[ + \nd*beginb + \nd*haveb {1}{P\vee Q} \\ + \nd*hypob {2}{\neg Q} \\ + \nd*openb + \nd*hypob {3}{P} \\ + \nd*haveb {4}{P} \mbox{by \ndref{3}} \\ + \nd*closeb + \nd*openb + \nd*hypob {5}{Q} \\ + \nd*haveb {6}{\neg Q} \mbox{by \ndref{2}} \\ + \nd*haveb {6a}{\bot} \mbox{by \ndref{5,6}} \\ + \nd*haveb {6b}{P} \mbox{by \ndref{6a}} \\ + \nd*closeb + \nd*haveb {8}{P} \mbox{by \ndref{1,3-4,5-6b}} \\ + \nd*endb +\] + +Here is another example, using a guard. + +\[ + \nd*beginb + \nd*hypob {1}{\neg\exists xP(x)} \\ + \nd*openb + \nd*guardb {1}{u} + \nd*openb + \nd*hypob {2}{P(u)} \\ + \nd*haveb {3}{\exists xP(x)} \mbox{by \ndref{2}} \\ + \nd*haveb {4}{\neg\exists xP(x)} \mbox{by \ndref{1}} \\ + \nd*haveb {5}{\bot} \mbox{by \ndref{3,4}}\\ + \nd*closeb + \nd*haveb {6}{\neg P(u)} \mbox{by \ndref{2-5}}\\ + \nd*closeb + \nd*haveb {7}{\forall y\neg P(y)} \mbox{by \ndref{2-6}}\\ + \nd*endb +\] + +LAYER C + +Layer C is a wrapper around layer B. It takes care of buffering +information and putting it correctly into an array. Specifically, in +layer C, it is no more necessary to explicitly give '\\', and all +hypotheses are denoted \hypo. Layer C also provides a convenient +syntax for writing justification labels. Further, layer C provides +``multi-line'' commands, thus e.g. \nd*mhypoc{a}{x\\y\\z} is an +abbreviation for \nd*hypoc{a}{x}\nd*hypocontc{y}\nd*hypocontc{z}. In +addition there is a \nd*by command for writing justification labels, +in the style of \nd*by{$\vee$E}{1,2-4,5-6}. + +Commands exported by layer C are: \nd*hypoc, \nd*havec, \nd*hypocontc, +\nd*havecontc, \nd*mhypoc, \nd*mhavec, \nd*mhypocontc, \nd*mhavecontc, +\nd*by, \nd*beginc, \nd*resumec, \nd*endc, \nd*openc, \nd*closec, +\nd*guardc. + +The layer C macros work by storing each line in a data structure +\ppp,\nd*typ,\nd*byt. The line is ejected when the beginning of the +next line is read, and once at the very end. In this way, we can put +in the correct line breaks (whether or not the line carries a +justification), and a hypothesis does not get typeset until we know +whether it is followed by another hypothesis. \nd*sto stores a new +line, \nd*clr clears the current line, \nd*cmd outputs the current +line. + +Example of layer C syntax: + +\[ + \nd*beginc + \nd*hypoc {1}{\neg\exists xP(x)} + \nd*openc + \nd*guardc {1}{u} + \nd*openc + \nd*hypoc {2}{P(u)} + \nd*havec {3}{\exists xP(x)} \nd*by{$\exists$I}{2} + \nd*havec {4}{\neg\exists xP(x)} \nd*by{R}{1} + \nd*havec {5}{\bot} \nd*by{$\neg$E}{3,4} + \nd*closec + \nd*havec {6}{\neg P(u)} \nd*by{$\neg$I}{2-5} + \nd*closec + \nd*havec {7}{\forall y\neg P(y)} \nd*by{$\forall$I}{2-6} + \nd*endc +\] + +LAYER D + +Layer D is the syntax used by the end user. It is implemented as a +wrapper around layer C, providing three additional conveniences: (1) a +latex environment, (2) guard as optional argument to \have, \hypo, or +\open, (3) optional relabeling arguments. The user level commands are +similar to those of layer C: they are called \begin{nd}, \end{nd}, +\open, \close, \hypo, \have, \guard, \by. For convenience, a number +of abbreviations are also provided for writing justifications. For +instance \ie for \by{$\Rightarrow$E} etc. These commands are only +visible inside an nd-environment; thus they do not interfere with the +global name space. There is also an environment ndresume which is like +nd, except that it continues a proof in progress (with continuous +nesting and labeling). + +The macros \nd*hypod, \nd*haved, \nd*opend, \nd*guardd are essentially +the user-level macros, but with all optional argument spelled-out. The +versions without the final "d" allow the optional arguments to be +omitted. + +The functions \nd*optarg and \nd*optargg are used to handle optional +arguments. Usage: \nd*optarg{default}{continuation}xxx - reads an +optional argument, supplies default if necessary, then continues with +continuation. Continuation expects optional argument between +[...]. I.e., \nd*optarg{d}{c}[xxx] => c[xxx], and \nd*optarg{d}{c}x => +c[d]x if x != '['. Behavior is undefined if x is {[...}. \nd*optargg +is similar except it takes two continuations: first one for optional +argument present, second for not present. It takes no default value. + +The function \nd*five{\a} reads five, partly optional arguments of the +shape [][]{}[]{}, then call \a with these arguments. + +Finally, \nd*init puts all the commands which are visible inside an +nd-environment in the current name space. + +Example of a derivation using layer D syntax. As before, the "line +numbers" are really labels, which will be replaced by consecutive line +numbers in the output. + +\[ +\begin{nd} + \hypo{1} {P\vee Q} + \hypo{2} {\neg Q} + \open + \hypo{3a} {P} + \have{3b} {P} \r{3a} + \close + \open + \hypo{4a} {Q} + \have{4b} {\neg Q} \r{2} + \have{4c} {\bot} \ne{4a,4b} + \have{4d} {P} \be{4c} + \close + \have{5} {P} \oe{1,3a-3b,4a-4d} +\end{nd} +\] + +Another example of layer D syntax, using guards and relabelings: + +\[ +\begin{nd} + \hypo {1} {P\vee Q} + \open[u] + \hypo {2} {P} + \have [\vdots] {3} {\vdots} + \have [n][-1] {4} {A\wedge B} + \close + \open + \hypo {5} {Q} + \have [\vdots] {6} {\vdots} + \have [m] {7} {A\wedge B} + \close + \have {8} {A\wedge B} \oe{1,2-(4),5-7} + \have [\vdots] {9} {\vdots} + \have [][100] {10} {A} \ae{8} +\end{nd} +\] diff --git a/macros/latex/contrib/fitch/fitch.sty b/macros/latex/contrib/fitch/fitch.sty new file mode 100644 index 0000000000..59e06c5a61 --- /dev/null +++ b/macros/latex/contrib/fitch/fitch.sty @@ -0,0 +1,231 @@ +%% fitch.sty +%% Macros for Fitch-style natural deduction +%% Copyright 2002-2023 Peter Selinger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% 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 Richard Zach <rzach@ucalgary.ca> +% +% This work consists of the files fitch.sty and fitchdoc.tex. + +% Original Author: Peter Selinger, Dalhousie University +% Created: Jan 14, 2002 +% Modified: Sep 4, 2023 +% Version: 0.6 +% Copyright: (C) 2002-2005 Peter Selinger +% Filename: fitch.sty +% Documentation: fitchdoc.tex +% https://github.com/OpenLogicProject/fitch/ + +% USAGE EXAMPLE: +% +% The following is a simple example illustrating the usage of this +% package. For detailed instructions and additional functionality, see +% the user guide, which can be found in the file fitchdoc.tex. +% +% \[ +% \begin{nd} +% \hypo{1} {P\vee Q} +% \hypo{2} {\neg Q} +% \open +% \hypo{3a} {P} +% \have{3b} {P} \r{3a} +% \close +% \open +% \hypo{4a} {Q} +% \have{4b} {\neg Q} \r{2} +% \have{4c} {\bot} \ne{4a,4b} +% \have{4d} {P} \be{4c} +% \close +% \have{5} {P} \oe{1,3a-3b,4a-4d} +% \end{nd} +% \] + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{fitch}[2023-09-04 v0.6 Macros for Fitch-style natural deduction] + +{\chardef\x=\catcode`\* +\catcode`\*=11 +\global\let\nd*astcode\x} +\catcode`\*=11 + +% References + +\newcount\nd*ctr +\def\nd*render{\expandafter\ifx\expandafter\nd*x\nd*base\nd*x\the\nd*ctr\else\nd*base\ifnum\nd*ctr<0\the\nd*ctr\else\ifnum\nd*ctr>0+\the\nd*ctr\fi\fi\fi} +\expandafter\def\csname nd*-\endcsname{} + +\def\nd*num#1{\nd*numo{\nd*render}{#1}\global\advance\nd*ctr1} +\def\nd*numopt#1#2{\nd*numo{$#1$}{#2}} +\def\nd*numo#1#2{\edef\x{#1}\mbox{$\x$}\expandafter\global\expandafter\let\csname nd*-#2\endcsname\x} +\def\nd*ref#1{\expandafter\let\expandafter\x\csname nd*-#1\endcsname\ifx\x\relax% + \PackageWarning{fitch}{Undefined line reference: #1}\mbox{\textbf{??}}\else\mbox{$\x$}\fi} +\def\nd*noop{} +\def\nd*set#1#2{\ifx\relax#1\nd*noop\else\global\def\nd*base{#1}\fi\ifx\relax#2\relax\else\global\nd*ctr=#2\fi} +\def\nd*reset{\nd*set{}{1}} +\def\nd*refa#1{\nd*ref{#1}} +\def\nd*aux#1#2{\ifx#2-\nd*refa{#1}--\def\nd*c{\nd*aux{}}% + \else\ifx#2,\nd*refa{#1}, \def\nd*c{\nd*aux{}}% + \else\ifx#2;\nd*refa{#1}; \def\nd*c{\nd*aux{}}% + \else\ifx#2.\nd*refa{#1}. \def\nd*c{\nd*aux{}}% + \else\ifx#2)\nd*refa{#1})\def\nd*c{\nd*aux{}}% + \else\ifx#2(\nd*refa{#1}(\def\nd*c{\nd*aux{}}% + \else\ifx#2\nd*end\nd*refa{#1}\def\nd*c{}% + \else\def\nd*c{\nd*aux{#1#2}}% + \fi\fi\fi\fi\fi\fi\fi\nd*c} +\def\ndref#1{\nd*aux{}#1\nd*end} + +% Layer A + +% define various dimensions (explained in fitchdoc.tex): +\newlength{\nd*dim} +\newdimen\nd*depthdim +\newdimen\nd*hsep +\newdimen\ndindent +\ndindent=1em +% user command to redefine dimensions +\def\nddim#1#2#3#4#5#6#7#8{\nd*depthdim=#3\relax\nd*hsep=#6\relax% +\def\nd*height{#1}\def\nd*thickness{#8}\def\nd*initheight{#2}% +\def\nd*indent{#5}\def\nd*labelsep{#4}\def\nd*justsep{#7}} +% set initial dimensions +\nddim{4.5ex}{3.5ex}{1.5ex}{1em}{1.6em}{.5em}{2.5em}{.2mm} + +\def\nd*v{\rule[-\nd*depthdim]{\nd*thickness}{\nd*height}} +\def\nd*t{\rule[-\nd*depthdim]{0mm}{\nd*height}\rule[-\nd*depthdim]{\nd*thickness}{\nd*initheight}} +\def\nd*i{\hspace{\nd*indent}} +\def\nd*s{\hspace{\nd*hsep}} +\def\nd*g#1{\nd*f{\makebox[\nd*indent][c]{$#1$}}} +\def\nd*f#1{\raisebox{0pt}[0pt][0pt]{$#1$}} +\def\nd*u#1{\makebox[0pt][l]{\settowidth{\nd*dim}{\nd*f{#1}}% + \addtolength{\nd*dim}{2\nd*hsep}\hspace{-\nd*hsep}\rule[-\nd*depthdim]{\nd*dim}{\nd*thickness}}\nd*f{#1}} + +% Lists + +\def\nd*push#1#2{\expandafter\gdef\expandafter#1\expandafter% + {\expandafter\nd*cons\expandafter{#1}{#2}}} +\def\nd*pop#1{{\def\nd*nil{\gdef#1{\nd*nil}}\def\nd*cons##1##2% + {\gdef#1{##1}}#1}} +\def\nd*iter#1#2{{\def\nd*nil{}\def\nd*cons##1##2{##1#2{##2}}#1}} +\def\nd*modify#1#2#3{{\def\nd*nil{\gdef#1{\nd*nil}}\def\nd*cons##1##2% + {\advance#2-1 ##1\advance#2 1 \ifnum#2=1\nd*push#1{#3}\else% + \nd*push#1{##2}\fi}#1}} + +\def\nd*cont#1{{\def\nd*t{\nd*v}\def\nd*v{\nd*v}\def\nd*g##1{\nd*i}% + \def\nd*i{\nd*i}\def\nd*nil{\gdef#1{\nd*nil}}\def\nd*cons##1##2% + {##1\expandafter\nd*push\expandafter#1\expandafter{##2}}#1}} + +% Layer B + +\newcount\nd*n +\def\nd*beginb{\begingroup\nd*reset\gdef\nd*stack{\nd*nil}\nd*push\nd*stack{\nd*t}% + \begin{array}{l@{\hspace{\nd*labelsep}}l@{\hspace{\nd*justsep}}l}} +\def\nd*resumeb{\begingroup\begin{array}{l@{\hspace{\nd*labelsep}}l@{\hspace{\nd*justsep}}l}} +\def\nd*endb{\end{array}\endgroup} +\def\nd*hypob#1#2{\nd*f{\nd*num{#1}}&\nd*iter\nd*stack\relax\nd*cont\nd*stack\nd*s\nd*u{#2}&} +\def\nd*haveb#1#2{\nd*f{\nd*num{#1}}&\nd*iter\nd*stack\relax\nd*cont\nd*stack\nd*s\nd*f{#2}&} +\def\nd*havecontb#1#2{&\nd*iter\nd*stack\relax\nd*cont\nd*stack\nd*s\nd*f{\hspace{\ndindent}#2}&} +\def\nd*hypocontb#1#2{&\nd*iter\nd*stack\relax\nd*cont\nd*stack\nd*s\nd*u{\hspace{\ndindent}#2}&} + +\def\nd*openb{\nd*push\nd*stack{\nd*i}\nd*push\nd*stack{\nd*t}} +\def\nd*closeb{\nd*pop\nd*stack\nd*pop\nd*stack} +\def\nd*guardb#1#2{\nd*n=#1\multiply\nd*n by 2 \nd*modify\nd*stack\nd*n{\nd*g{#2}}} + +% Layer C + +\def\nd*clr{\gdef\nd*cmd{}\gdef\nd*typ{\relax}} +\def\nd*sto#1#2#3{\gdef\nd*typ{#1}\gdef\nd*byt{}% + \gdef\nd*cmd{\nd*typ{#2}{#3}\nd*byt\\}} +\def\nd*chtyp{\expandafter\ifx\nd*typ\nd*hypocontb\def\nd*typ{\nd*havecontb}\else\def\nd*typ{\nd*haveb}\fi} +\def\nd*hypoc#1#2{\nd*chtyp\nd*cmd\nd*sto{\nd*hypob}{#1}{#2}} +\def\nd*havec#1#2{\nd*cmd\nd*sto{\nd*haveb}{#1}{#2}} +\def\nd*hypocontc#1{\nd*chtyp\nd*cmd\nd*sto{\nd*hypocontb}{}{#1}} +\def\nd*havecontc#1{\nd*cmd\nd*sto{\nd*havecontb}{}{#1}} +\def\nd*by#1#2{\ifx\nd*x#2\nd*x\gdef\nd*byt{\mbox{#1}}\else\gdef\nd*byt{\mbox{#1, \ndref{#2}}}\fi} + +% multi-line macros +\def\nd*mhypoc#1#2{\nd*mhypocA{#1}#2\\\nd*stop\\} +\def\nd*mhypocA#1#2\\{\nd*hypoc{#1}{#2}\nd*mhypocB} +\def\nd*mhypocB#1\\{\ifx\nd*stop#1\else\nd*hypocontc{#1}\expandafter\nd*mhypocB\fi} +\def\nd*mhavec#1#2{\nd*mhavecA{#1}#2\\\nd*stop\\} +\def\nd*mhavecA#1#2\\{\nd*havec{#1}{#2}\nd*mhavecB} +\def\nd*mhavecB#1\\{\ifx\nd*stop#1\else\nd*havecontc{#1}\expandafter\nd*mhavecB\fi} +\def\nd*mhypocontc#1{\nd*mhypocB#1\\\nd*stop\\} +\def\nd*mhavecontc#1{\nd*mhavecB#1\\\nd*stop\\} + +\def\nd*beginc{\nd*beginb\nd*clr} +\def\nd*resumec{\nd*resumeb\nd*clr} +\def\nd*endc{\nd*cmd\nd*endb} +\def\nd*openc{\nd*cmd\nd*clr\nd*openb} +\def\nd*closec{\nd*cmd\nd*clr\nd*closeb} +\let\nd*guardc\nd*guardb + +% Layer D + +% macros with optional arguments spelled-out +\def\nd*hypod[#1][#2]#3[#4]#5{\ifx\relax#4\relax\else\nd*guardb{1}{#4}\fi\nd*mhypoc{#3}{#5}\nd*set{#1}{#2}} +\def\nd*haved[#1][#2]#3[#4]#5{\ifx\relax#4\relax\else\nd*guardb{1}{#4}\fi\nd*mhavec{#3}{#5}\nd*set{#1}{#2}} +\def\nd*havecont#1{\nd*mhavecontc{#1}} +\def\nd*hypocont#1{\nd*mhypocontc{#1}} +\def\nd*base{undefined} +\def\nd*opend[#1]#2{\nd*cmd\nd*clr\nd*openb\nd*guard{#1}#2} +\def\nd*close{\nd*cmd\nd*clr\nd*closeb} +\def\nd*guardd[#1]#2{\nd*guardb{#1}{#2}} + +% Handling of optional arguments. + +\def\nd*optarg#1#2#3{\ifx[#3\def\nd*c{#2#3}\else\def\nd*c{#2[#1]{#3}}\fi\nd*c} +\def\nd*optargg#1#2#3{\ifx[#3\def\nd*c{#1#3}\else\def\nd*c{#2{#3}}\fi\nd*c} + +\def\nd*five#1{\nd*optargg{\nd*four{#1}}{\nd*two{#1}}} +\def\nd*four#1[#2]{\nd*optarg{0}{\nd*three{#1}[#2]}} +\def\nd*three#1[#2][#3]#4{\nd*optarg{}{#1[#2][#3]{#4}}} +\def\nd*two#1{\nd*three{#1}[\relax][]} + +\def\nd*have{\nd*five{\nd*haved}} +\def\nd*hypo{\nd*five{\nd*hypod}} +\def\nd*open{\nd*optarg{}{\nd*opend}} +\def\nd*guard{\nd*optarg{1}{\nd*guardd}} + +\def\nd*init{% + \let\open\nd*open% + \let\close\nd*close% + \let\hypo\nd*hypo% + \let\have\nd*have% + \let\hypocont\nd*hypocont% + \let\havecont\nd*havecont% + \let\by\nd*by% + \let\guard\nd*guard% + \def\ii{\by{$\Rightarrow$I}}% + \def\ie{\by{$\Rightarrow$E}}% + \def\Ai{\by{$\forall$I}}% + \def\Ae{\by{$\forall$E}}% + \def\Ei{\by{$\exists$I}}% + \def\Ee{\by{$\exists$E}}% + \def\ai{\by{$\wedge$I}}% + \def\ae{\by{$\wedge$E}}% + \def\ai{\by{$\wedge$I}}% + \def\ae{\by{$\wedge$E}}% + \def\oi{\by{$\vee$I}}% + \def\oe{\by{$\vee$E}}% + \def\ni{\by{$\neg$I}}% + \def\ne{\by{$\neg$E}}% + \def\be{\by{$\bot$E}}% + \def\nne{\by{$\neg\neg$E}}% + \def\r{\by{R}}% +} + +\newenvironment{nd}{\begingroup\nd*init\nd*beginc}{\nd*endc\endgroup} +\newenvironment{ndresume}{\begingroup\nd*init\nd*resumec}{\nd*endc\endgroup} + +\catcode`\*=\nd*astcode + +% End of file fitch.sty + diff --git a/macros/latex/contrib/fitch/fitchdoc-dimen.pdf b/macros/latex/contrib/fitch/fitchdoc-dimen.pdf Binary files differnew file mode 100644 index 0000000000..33f61cb99e --- /dev/null +++ b/macros/latex/contrib/fitch/fitchdoc-dimen.pdf diff --git a/macros/latex/contrib/fitch/fitchdoc.pdf b/macros/latex/contrib/fitch/fitchdoc.pdf Binary files differnew file mode 100644 index 0000000000..c0948c9096 --- /dev/null +++ b/macros/latex/contrib/fitch/fitchdoc.pdf diff --git a/macros/latex/contrib/fitch/fitchdoc.tex b/macros/latex/contrib/fitch/fitchdoc.tex new file mode 100644 index 0000000000..1889721dd0 --- /dev/null +++ b/macros/latex/contrib/fitch/fitchdoc.tex @@ -0,0 +1,406 @@ +%% fitchdoc.tex +%% Macros for Fitch-style natural deduction (documentation) +%% Copyright 2002-2023 Peter Selinger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% 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 Richard Zach <rzach@ucalgary.ca> +% +% This work consists of the files fitch.sty and fitchdoc.tex. + +% Original Author: Peter Selinger, Dalhousie University +% Created: Jan 14, 2002 +% Modified: Sep 4, 2023 +% Version: 0.6 +% Copyright: (C) 2002-2023 Peter Selinger +% Filename: fitch.sty +% Documentation: fitchdoc.tex +% https://github.com/OpenLogicProject/fitch/ + +\documentclass{ltxdoc} + +\usepackage{fitch,graphicx,showexpl,fullpage} + +\lstset{% + basicstyle=\ttfamily\small, + commentstyle=\itshape\ttfamily\small, + showspaces=false, + showstringspaces=false, + breaklines=true, + breakautoindent=true, + captionpos=t +} + +\title{\texttt{fitch.sty}: Fitch-style natural deduction macros} + +\author{Peter Selinger\\Dalhousie University\thanks{The current +maintainer of this package is \href{https://richardzach.org}{Richard +Zach}. The package repository is at +\url{https://github.com/OpenLogicProject/fitch/}, where you can also +report any \href{https://github.com/OpenLogicProject/fitch/issues}{issues} with it.}} + +\date{Version 0.6\\ September 4, 2023} + +\begin{document} +\maketitle + +\section{Overview} + +This document describes how to use the {\tt fitch.sty} macros for +typesetting Fitch-style natural deduction derivations. To load the macros, +simply put \verb!\usepackage{fitch}! into the preamble of your +{\LaTeX} file. + +Here is a natural deduction derivation, together with the code that +produced it: + +\begin{LTXexample} +\[ +\begin{nd} + \hypo {1} {P\vee Q} + \hypo {2} {\neg Q} + \open + \hypo {3} {P} + \have {4} {P} \r{3} + \close + \open + \hypo {aa} {Q} + \have {6} {\neg Q} \r{2} + \have {7} {\bot} \ne{aa,6} + \have {8} {P} \be{7} + \close + \have {9} {P} \oe{1,3-4,aa-8} +\end{nd} +\] +\end{LTXexample} + +A derivation consists of \emph{lines}, and each line contains a {\em +line number} and a \emph{formula}. Some lines also carry a {\em +justification}. Moreover, each line is either a \emph{hypothesis} or a +\emph{derived formula}. Generally, derived formulas carry a +justification, whereas hypotheses do not; however, the macros do not +enforce this. + +\DescribeEnv{nd} +Derivations are typeset inside the \verb!nd! environment, which must be +used in math mode. + +\DescribeMacro{\hypo}\DescribeMacro{\have} +The commands \verb!\hypo! and \verb!\have! are used +to typeset one line of the derivation; \verb!\hypo! is used for +hypotheses, and \verb!\have! for derived formulas. Both commands take +a label and a formula as an argument. Note that the labels used to +identify lines in the derivation need not be actual line numbers; for +instance, in the above example, we used the label $aa$ instead of $5$. +In the output, lines are automatically numbered consecutively. Labels +may not contain any punctuation characters or spaces. + +\DescribeMacro{\open}\DescribeMacro{\close} +Subderivations are opened and closed with the commands \verb!\open! and +\verb!\close!. Finally, the following commands are provided for +annotating lines with justifications: + +\medskip +\hfill +\begin{tabular}{@{}ll@{}} + \verb!\r! & reiteration \\ + \verb!\ii! & implication introduction \\ + \verb!\ie! & implication elimination \\ + \verb!\ai! & and introduction \\ + \verb!\ae! & and elimination \\ +\end{tabular} +\hfill +\begin{tabular}{ll} + \verb!\oi! & or introduction \\ + \verb!\oe! & or elimination \\ + \verb!\ni! & not introduction \\ + \verb!\ne! & not elimination \\ + \verb!\be! & bottom elimination \\ +\end{tabular} +\hfill +\begin{tabular}{@{}ll@{}} + \verb!\nne! & double negation elimination \\ + \verb!\Ai! & forall introduction \\ + \verb!\Ae! & forall elimination \\ + \verb!\Ei! & exists introduction \\ + \verb!\Ee! & exists elimination \\ +\end{tabular} +\hfill +\medskip + +Each such command takes a \emph{reference list} as an argument. A +reference list is a string made from labels, commas, and hyphens, for +instance \verb!1,3a-3b,4a-4d!. + +\section{Details} + +\subsection{Guards} + +Some natural deduction derivations with quantifiers use \emph{guards}, as in +the following example: + +\begin{LTXexample} +\[ +\begin{nd} + \hypo {1} {\exists x\forall y.P(x,y)} + \open[v] + \open[u] + \hypo {2} {\forall y.P(u,y)} + \have {3} {P(u,v)} \Ae{2} + \have {4} {\exists x.P(x,v)} \Ei{3} + \close + \have {5} {\exists x.P(x,v)} \Ee{1,2-5} + \close + \have {6} {\forall y\exists x.P(x,y)} \Ai{2-5} +\end{nd} +\] +\end{LTXexample} + +The guards $v$ and $u$ in line 2 were typeset by giving optional +arguments to the \verb!\open! commands of the respective +subderivations. + +\DescribeMacro{\guard} +For most purposes, the above way of specifying guards is sufficient. +However, there is another method, which allows a more flexible +placement of guards: before any line, you can give the command +\verb!\guard{u}! to add a guard $u$ to the top-level subderivation at +that line, or \verb!\guard[n]{u}! to add a guard to the $n$th +enclosing subderivation at that line. Thus, the above example could +have also been typeset by inserting the two commands \verb!\guard{u}! and +\verb!\guard[2]{v}! just after the second \verb!\open! statement. + +% For backward compatibility, there is a third way of specifying guards +% by giving an optional second argument to the \verb!\hypo! and +% \verb!\have! commands. The use of this feature is discouraged. + +\subsection{Generic justifications} + +Non-standard justifications can be created with the \verb!\by! +command. This command takes two arguments: a name and a reference +list. For instance, the command \verb!\by{De Morgan}{lab3,lab4}! might +produce the output ``\mbox{De Morgan, 3, 4}''. Note that the justification +is typeset in text mode. A comma is automatically inserted between the +name and the reference list, unless the reference list is empty. + +\subsection{Label and reference list details} + +Labels may not contain commas, periods, semicolons, hyphens, +parenthesis, or spaces. In a reference list, spaces are ignored (even +within a label!), whereas commas, periods, semicolons, parenthesis, +and hyphens are copied to the output. All other characters are +interpreted as part of a label. Attempting to reference a label which +has not been previously defined by any \verb!\hypo! or \verb!\have! +command produces an error message of the form: + +\begin{verbatim} + ! Package fitch Error: Undefined line reference: lab17. +\end{verbatim} + +\subsection{Referencing line numbers in the text} +\label{subsec-ndref} + +\DescribeMacro{\ndref} +Labels defined in an \verb!nd! environment can be referenced in the +text with the \verb!\ndref! command. This command takes a reference +list as an argument, and produces the corresponding output. However, +it is only possible to reference labels \emph{after} the corresponding +derivation has been typeset. There is currently no convenient way of +defining forward references. Also, if a label is used more than once, +\verb!\ndref! will always refer to the most recent time it was used. + +\subsection{Scope} + +The commands \verb!\hypo!, \verb!\have!, \verb!\open!, \verb!\close!, +\verb!\r!, \verb!\ii!, and so forth are only available inside an +\verb!nd! environment. These commands may have a different meaning +elsewhere in the same document. The only commands provided by the +\verb!fitch.sty! package which are visible outside an \verb!nd! +environment are the command \verb!\ndref! described in +Section~\ref{subsec-ndref}, and the command \verb!\nddim! and the +dimension \verb!\ndindent! described in Section~\ref{subsec-nddim}. + +\subsection{Breaking it across pages}\label{subsec-break} + +\DescribeMacro{\ndresume} +The \verb!nd! environment is derived from the {\LaTeX} \verb!array! +environment, and thus it does not break across pages automatically. +However, if a derivation is too long to fit on a single page, it is +possible to split it manually into physically independent, but +logically consecutive subparts. For this purpose, the \verb!ndresume! +environment is provided to continue a previously interrupted +derivation. Here is an example: + +\begin{LTXexample} +$ +\begin{nd} + \hypo {1} {P\vee Q} + \hypo {2} {\neg Q} + \open + \hypo {3} {P} + \have {4} {P} \r{3} + \close + \open + \hypo {aa} {Q} + \have {6} {\neg Q} \r{2} +\end{nd} +$ + +Derivations can be interrupted and +resumed at any point. + +$ +\begin{ndresume} + \have {7} {\bot} \ne{aa,6} + \have {8} {P} \be{7} + \close + \have {9} {P} \oe{1,3-4,aa-8} +\end{ndresume} +$ +\end{LTXexample} + +\subsection{Custom line numbers} + +One often needs to write derivation schemas, rather than derivations. +This often requires the use of symbolic constants such as $n$, $n+1$, +etc, instead of actual line numbers. The \verb!\have! and \verb!\hypo! +commands have an optional first argument which is a symbolic constant. +For instance, \verb!\have[n]! will cause the current line to be +numbered with the symbolic constant $n$. Subsequent lines are +automatically numbered $n+1$ etc. An initial offset can be given as a +second optional argument, as in \verb!\have[n][-1]!, which will cause +the current line to be numbered $n-1$, the following line $n$, etc. In +an explicit offset is given, the symbolic constant can also be absent: +for instance, the command \verb!\have[][7]! resets the current line +number to $7$. The following example illustrates this behavior: + +\begin{LTXexample} +\[ +\begin{nd} + \hypo {1} {P\vee Q} + \open + \hypo {2} {P} + \have [\vdots] {3} {\vdots} + \have [n][-1] {4} {A\wedge B} + \close + \open + \hypo {5} {Q} + \have [\vdots] {6} {\vdots} + \have [m] {7} {A\wedge B} + \close + \have {8} {A\wedge B} \oe{1,2-(4),5-7} + \have [\vdots] {9} {\vdots} + \have [][100] {10} {A} \ae{8} +\end{nd} +\] +\end{LTXexample} + +Note that in the justification for line $m+1$, parentheses had to be +put around the label $4$. There is currently no way of doing this +automatically. + +{\bf Exercise.} How does one typeset an empty line number? + +{\bf Solution.} Since \verb!\have[]! has a special meaning as explained +above, we need to use \verb!\have[~]! instead. + +\subsection{Continuation lines}\label{subsec-continuation} + +Sometimes one has to typeset a very long formula that does not fit on +a single line. As of version 0.5 of the {\tt fitch.sty} macros, it is +possible to break a formula into several lines using \verb!\\! as a +line separator. Continuation lines are automatically indented, as +shown in the following example. + +\begin{LTXexample} +\[ +\begin{nd} + \hypo{1} {A\wedge B} + \hypo{2} {A\wedge B\rightarrow{} \\ + C\wedge D} + \have{3} {C\wedge D} \ie{1,2} + \have{4} {A\wedge B\wedge{} \\ + C\wedge D} \ai{1,3} +\end{nd} +\] +\end{LTXexample} + +\DescribeMacro{\hypocont} +\DescribeMacro{\havecont} +Alternatively, the \verb!\havecont! and \verb!\hypocont! commands can +be used to specify each continuation line separately, as the following +example illustrates. + +\begin{LTXexample} +\[ +\begin{nd} + \hypo{1} {A\wedge B} + \hypo{2} {A\wedge B\rightarrow{}} + \hypocont {C\wedge D} + \have{3} {C\wedge D} \ie{1,2} + \have{4} {A\wedge B\wedge{}} \ai{1,3} + \havecont {C\wedge D} +\end{nd} +\] +\end{LTXexample} + +This latter style gives slightly more flexibility in the placement of +justifications, since each line and continuation line can have its own +justification and its own guard (via the \verb!\guard! command). It +also allows a derivation to be interrupted between a line and its +continuation, as discussed in Section~\ref{subsec-break}. + +\subsection{Customizing dimensions}\label{subsec-nddim} + +\DescribeMacro{\nddim} +The relative sizes of the various elements of a natural deduction +proof are preset to reasonable values depending on the size of the +currently selected font. However, it will sometimes be necessary to +customize these dimensions. This can be achieved with the +\verb!\nddim! command. The syntax of the command is as follows: +\begin{center} + \cmd{\nddim}\marg{height}\marg{topheight}\marg{depth}\marg{labelsep} + \marg{indent}\marg{hsep}\marg{justsep}\marg{linethickness}, +\end{center} +where each of the eight parameters is a dimension. The meaning of the +first seven parameters is shown in the +following illustrations; \emph{linethickness} is simply the thickness +of the lines. +\[\includegraphics{fitchdoc-dimen}\] +The default dimensions are: +\begin{center} +\verb!\nddim{4.5ex}{3.5ex}{1.5ex}{1em}{1.6em}{.5em}{2.5em}{.2mm}!. +\end{center} +\DescribeMacro{\ndindent} +In addition, the dimension \verb!\ndindent!, controls +the amount of extra indentation used on continuation lines as +discussed in Section~\ref{subsec-continuation}. It can be changed and +is \verb!1ex! by default. + +\subsection{Other comments} + +The goal was to design a flexible package which would not impose any +constraints on the form of derivations, while making typesetting easy. +With this package, it is in fact possible to typeset incomplete, +ill-formed, or invalid derivations. Sometimes it is pedagogically necessary +to do so. + +There are no arbitrary limits on the size or nesting depth of a derivation, +except for the obvious requirement of fitting horizontally on the +printed page. + +\section{Copyright and license} + +This document and the accompanying \verb!fitch.sty! macros +are {\copyright} 2002--2023 by Peter Selinger and distributed under +the terms of the \href{https://www.latex-project.org/lppl/}{LPPL}. + +\end{document} diff --git a/macros/latex/contrib/fitch/fitchexample.png b/macros/latex/contrib/fitch/fitchexample.png Binary files differnew file mode 100644 index 0000000000..d66390786e --- /dev/null +++ b/macros/latex/contrib/fitch/fitchexample.png diff --git a/macros/latex/contrib/l3build/CHANGELOG.md b/macros/latex/contrib/l3build/CHANGELOG.md index 76729d5dc6..e23a7764f9 100644 --- a/macros/latex/contrib/l3build/CHANGELOG.md +++ b/macros/latex/contrib/l3build/CHANGELOG.md @@ -7,6 +7,13 @@ this project uses date-based 'snapshot' version identifiers. ## [Unreleased] +## [2023-09-05] + +### Changed +- Initialise the random seed with the current time so `--shuffle` produces different orders each run. +- Normalise more `luaotfload` cache lines +- Apply `-utc` switch for LuaTeX when using a fixed epoch value + ## [2023-07-20] - Set `-kanji-internal=euc` when building pLaTeX @@ -58,7 +65,7 @@ this project uses date-based 'snapshot' version identifiers. ### Fixed - Restore epoch settings for `dvitopdf()` -- Use plural form of variable `ps2pdfopts` consistently in code and doc, and +- Use plural form of variable `ps2pdfopts` consistently in code and doc, and retain compatibility with singular form `ps2pdfopt` (issue \#275) - Remove the last trace of dropped variable `stdconfig` @@ -684,7 +691,8 @@ this project uses date-based 'snapshot' version identifiers. - Rationalise short option names: removed `-d`, `-E`, `-r` - Target `cmdcheck`: specific to LaTeX kernel work -[Unreleased]: https://github.com/latex3/l3build/compare/2023-07-20...HEAD +[Unreleased]: https://github.com/latex3/l3build/compare/2023-09-05...HEAD +[2023-09-05]: https://github.com/latex3/l3build/compare/2023-07-20...2023-09-05 [2023-07-20]: https://github.com/latex3/l3build/compare/2023-07-17...2023-07-20 [2023-07-17]: https://github.com/latex3/l3build/compare/2023-03-27...2023-07-17 [2023-03-27]: https://github.com/latex3/l3build/compare/2023-03-22...2023-03-27 diff --git a/macros/latex/contrib/l3build/README.md b/macros/latex/contrib/l3build/README.md index 60b9815c7e..779c91cad9 100644 --- a/macros/latex/contrib/l3build/README.md +++ b/macros/latex/contrib/l3build/README.md @@ -1,7 +1,7 @@ l3build: a testing and building system for LaTeX ================================================= -Release 2023-07-20 +Release 2023-09-05 Overview -------- diff --git a/macros/latex/contrib/l3build/l3build-check.lua b/macros/latex/contrib/l3build/l3build-check.lua index b1c33c6d56..3f1f5d5542 100644 --- a/macros/latex/contrib/l3build/l3build-check.lua +++ b/macros/latex/contrib/l3build/l3build-check.lua @@ -48,6 +48,9 @@ local exit = os.exit local execute = os.execute local remove = os.remove +-- randomise the random numbers +math.randomseed( os.time() ) + -- -- Auxiliary functions which are used by more than one main function -- @@ -155,6 +158,8 @@ local function normalize_log(content,engine,errlevels) -- More luaotfload line = gsub(line, "database loaded from " .. pattern .. "%)", "database loaded from ../%1)") + line = gsub(line, 'Root cache directory is "' .. pattern .. '"', + 'Root cache directory is ".../%1"') -- Deal with XeTeX specials if match(line, "^%.+\\XeTeX.?.?.?file") then line = gsub(line, pattern, "../%1") diff --git a/macros/latex/contrib/l3build/l3build.1 b/macros/latex/contrib/l3build/l3build.1 index 23008a64fc..941958d57f 100644 --- a/macros/latex/contrib/l3build/l3build.1 +++ b/macros/latex/contrib/l3build/l3build.1 @@ -1,4 +1,4 @@ -.TH l3build 1 "2023-07-20" +.TH l3build 1 "2023-09-05" .SH NAME l3build \- Checking and building packages .SH SYNOPSIS diff --git a/macros/latex/contrib/l3build/l3build.dtx b/macros/latex/contrib/l3build/l3build.dtx index 48c7ab87c8..0ca5366d81 100644 --- a/macros/latex/contrib/l3build/l3build.dtx +++ b/macros/latex/contrib/l3build/l3build.dtx @@ -251,7 +251,7 @@ % }^^A % } % -% \date{Released 2023-07-20} +% \date{Released 2023-09-05} % % \maketitle % \tableofcontents diff --git a/macros/latex/contrib/l3build/l3build.lua b/macros/latex/contrib/l3build/l3build.lua index ffabdcc4b0..66f50e9641 100755 --- a/macros/latex/contrib/l3build/l3build.lua +++ b/macros/latex/contrib/l3build/l3build.lua @@ -25,7 +25,7 @@ for those people who are interested. --]] -- Version information -release_date = "2023-07-20" +release_date = "2023-09-05" -- File operations are aided by the LuaFileSystem module local lfs = require("lfs") @@ -117,6 +117,17 @@ if options["epoch"] then forcedocepoch = true end epoch = normalise_epoch(epoch) +-- LuaTeX needs the `-utc` option +if next(specialformats) and next(specialformats.latex) + and next (specialformats.latex.luatex) then + local options = specialformats.latex.luatex.options + specialformats.latex.luatex.options = (options and (options .. " ") or "") .. "-utc" +end +if next(specialformats) and next(specialformats["latex-dev"]) + and next (specialformats["latex-dev"].luatex) then + local options = specialformats["latex-dev"].luatex.options + specialformats["latex-dev"].luatex.options = (options and (options .. " ") or "") .. "-utc" +end -- -- Deal with multiple configs for tests diff --git a/macros/latex/contrib/l3build/l3build.pdf b/macros/latex/contrib/l3build/l3build.pdf Binary files differindex 7fe2b2e927..ac44c0e0ce 100644 --- a/macros/latex/contrib/l3build/l3build.pdf +++ b/macros/latex/contrib/l3build/l3build.pdf diff --git a/macros/latex/contrib/photobook/photobook.cls b/macros/latex/contrib/photobook/photobook.cls index 899a488069..54b7d1f0b3 100644 --- a/macros/latex/contrib/photobook/photobook.cls +++ b/macros/latex/contrib/photobook/photobook.cls @@ -93,7 +93,7 @@ %%% NOTE: \def\<module-name>@[A-Z]+ macros will be visible to both the %%% code and the generated docs... -\edef\photobook@FILEVERSION{v0.1.25} +\edef\photobook@FILEVERSION{v0.1.26} \edef\photobook@FILEDATE{2023-08-24} @@ -2046,7 +2046,7 @@ \setlength\photobook@cliptocell@right{0mm}% \newlength\photobook@cliptocell@bottom \setlength\photobook@cliptocell@bottom{0mm}% -\def\cliptocellclearances{0mm 0mm 0mm 0mm}% +\def\cliptocellclearances{{0mm} {0mm} {0mm} {0mm}}% %% Set the default bleeds for |cliptocell| environments %% @@ -2061,9 +2061,8 @@ %%% %%% Set by |\cliptocellbleeds{..}| and contains clearances (negative %%% clipping bleeds) usable by imagecell. -% -% XXX BUG: bleeds is set correctly for one value but 2 and 4 seem to be -% misbehaving (see: ./examples/endpaper.tex) +%%% +%%% XXX still testing.... \newcommand\cliptocellbleeds[1]{ \setsepchar{ }% \readlist*\photobook@cliptocell@bleeds{#1}% @@ -2099,12 +2098,15 @@ \setlength\photobook@cliptocell@top{% \photobook@cliptocell@bleeds[4]}\fi% % NOTE: trailing spaces here are significant... + % XXX should we use \the here? + % ...it makes things printable... \def\cliptocellclearances{% - {-\photobook@cliptocell@left} % - {-\photobook@cliptocell@bottom} % - {-\photobook@cliptocell@right} % - {-\photobook@cliptocell@top}}} + {-\the\photobook@cliptocell@left} % + {-\the\photobook@cliptocell@bottom} % + {-\the\photobook@cliptocell@right} % + {-\the\photobook@cliptocell@top}}} +% XXX use \cliptocellclearances as default... \newenvironment{cliptocell}[1][0mm]{% \begingroup% \cliptocellbleeds{#1} @@ -4270,10 +4272,16 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %%%%% Basic book information -%% \DescribeMacro{BookType=<text>} -\def\BookType{book} % XXX Document metadata -- move to globals... % XXX Use LaTeX generic metadata... +%% \DescribeMacro{BookType=<text>} +% +%% Used in page macro text to indicate the type of document built, by default +%% this is set to |book| for the most common case but can be set to anything +%% (e.g. |brochure|, |magazine|, |presentation|, ...etc.) +%% +\def\BookType{book} + %% \DescribeMacro{BookTitle=<text>} \def\BookTitle{} %% \DescribeMacro{BookVersion=<text>} diff --git a/macros/latex/contrib/photobook/photobook.pdf b/macros/latex/contrib/photobook/photobook.pdf Binary files differindex 953e58eace..a51b6c384d 100644 --- a/macros/latex/contrib/photobook/photobook.pdf +++ b/macros/latex/contrib/photobook/photobook.pdf diff --git a/macros/latex/contrib/photobook/scripts/README.md b/macros/latex/contrib/photobook/scripts/README.md index 7befc14228..9ed4739884 100644 --- a/macros/latex/contrib/photobook/scripts/README.md +++ b/macros/latex/contrib/photobook/scripts/README.md @@ -137,7 +137,7 @@ or multiples, ...etc.? At this stage this is about the presentation, the flow of the work and not about the actual design. How many typical spreads (i.e. spread templates) should it have? A good number should be small-ish, for example 3-4 spread templates is a good number, if you -count 10+ then you might be overcomplicating tings, but note, there are +count 10+ then you might be overcomplicating things, but note, there are no rules, a book where each spread is individually and manually layed out may work as well as a book with just a single template spread, but in general for a photo book the focus is on the project and the layout @@ -344,6 +344,8 @@ IMAGE_FORMATS=jpeg|jpg|png|pdf|svg|eps SPREADS_DIR=spreads/ # if non-empty link link images to matching ones from this directory... +# NOTE: this is ignored if --graphicx-path is passed or GRAPHICX_PATH +# is set. IMAGE_HIRES_DIR= # directory where external captions are stored... @@ -370,6 +372,10 @@ IMAGE_SPREAD=( [0]=text-spread [2]=image-image ) + +# if set (or --graphicx-path is passed) the images are identified by their +# basename so as to let graphicx package resolve the paths internally. +GRAPHICX_PATH=1 ``` An explicit configuration file can be manually specified: diff --git a/macros/latex/contrib/photobook/scripts/make-spreads.sh b/macros/latex/contrib/photobook/scripts/make-spreads.sh index 41dae4ec27..4f8b30db2a 100644 --- a/macros/latex/contrib/photobook/scripts/make-spreads.sh +++ b/macros/latex/contrib/photobook/scripts/make-spreads.sh @@ -132,6 +132,9 @@ printhelp(){ echo " - text spread default template (default: ${IMAGE_SPREAD[0]})." echo " --captions PATH" echo " - path to search for captions (default: $CAPTION_DIR)." + echo " --graphicx-path" + echo " - reference images by their basenames and let graphicx manage" + echo " searching." echo echo "Parameters:" echo " PATH - path to root pages directory (default: $SPREADS_DIR)" @@ -214,6 +217,11 @@ while true ; do shift 2 continue ;; + --graphicx-path) + GRAPHICX_PATH=1 + shift + continue + ;; # handle unknown options... -*|--*) @@ -350,6 +358,12 @@ templateSlots(){ # usage: # populateTemplate SPREAD TEMPLATE ITEMS... # +# closure: $populateTemplate_img, $populateTemplate_txt +# +# NOTE: this is the least hacky/ugly but could not figure out a better +# way to update a list from within a function... +populateTemplate_img= +populateTemplate_txt= populateTemplate(){ local spread="$1" local tpl="$2" @@ -374,6 +388,16 @@ populateTemplate(){ txt+=("$elem") fi done + local global_img= + if ! [ -z $populateTemplate_img ] ; then + global_img=1 + img=(${populateTemplate_img[@]}) + fi + local global_txt= + if ! [ -z $populateTemplate_txt ] ; then + global_txt=1 + txt=(${populateTemplate_txt[@]}) + fi local var local val @@ -412,6 +436,9 @@ populateTemplate(){ text=$(echo "${text}" | \ sed "s/\${${var}}/${val%.*}/g") done + if ! [ -z $global_img ] ; then + populateTemplate_img=("${populateTemplate_img[@]:$i}") + fi # pass 2: captions... for var in ${slots[@]} ; do @@ -456,6 +483,9 @@ populateTemplate(){ text=$(echo "${text}" | \ sed "s/\${${var}}/${val}/g") done + if ! [ -z $global_txt ] ; then + populateTemplate_txt=("${txt[@]}") + fi # print out the filled template... echo % template: $tpl @@ -468,7 +498,7 @@ populateTemplate(){ # usage: # handleSpread SPREAD # -# closure: $IMAGE_HIRES_DIR, $IMAGE_SPREAD +# closure: $GRAPHICX_PATH, $IMAGE_HIRES_DIR, $IMAGE_SPREAD handleSpread(){ local spread="$1" # skip non-spreads... @@ -502,21 +532,32 @@ handleSpread(){ fi done + # graphicx paths... + if ! [ -z $GRAPHICX_PATH ] ; then + local C=0 + for image in "${img[@]}" ; do + local new=`basename ${image}` + new="${new#+([0-9])-}" + img[$C]=$new + C=$(( C + 1 )) + done # get hi-res image paths... - if ! [ -z $IMAGE_HIRES_DIR ] ; then + elif ! [ -z $IMAGE_HIRES_DIR ] ; then local C=0 for image in "${img[@]}" ; do # skip non-images... - local new="$IMAGE_HIRES_DIR/`basename ${image/[0-9]-/}`" + local new=`basename ${image}` + new="$IMAGE_HIRES_DIR/${new#+([0-9])-}" # ignore file ext for availability test... # NOTE: the first match may be an unsupported format... new="${new%.*}" + local target=$new new=($new.*) if [ -e "${new[0]}" ] ; then img[$C]=${new[0]} else echo % - echo "% WARNING: hi-res image not found for: \"${image}\" -> \"${new}\"" \ + echo "% WARNING: hi-res image not found for: \"${image}\" -> \"${target}\"" \ | tee >(cat >&2) echo % fi @@ -565,43 +606,37 @@ handleSpread(){ cat "${template}" fi fi + populateTemplate_img=("${img[@]}") + populateTemplate_txt=("${txt[@]}") + for elem in "${items[@]}" ; do C=$(( C + 1 )) P=$([ $C == 1 ] \ && echo "left" \ || echo "right") - # XXX need to use populateTemplate here... - # ...to do this need to somehow remove the used - # slots/files from list... - # image... if [[ "${elem,,}" =~ $IMAGE_FORMATS ]] ; then echo % echo "% $P page (image)..." template=`getTemplate "$spread" "$IMAGE_PAGE"` - echo % template: $template - anotatePath "${elem}" - local caption=$(getCaption "$spread" "${elem}") - caption=$(readCaption "$caption") - cat "${template}" \ - | sed -e "s%\${IMAGE0\?}%${elem%.*}%" \ - -e "s%\${CAPTION0\?}%${caption}%" + populateTemplate "$spread" "$template" # text... else echo % echo "% $P page (text)..." template=$(getTemplate "$spread" "$TEXT_PAGE") - echo % template: $template - cat "${template}" \ - | sed "s%\${TEXT}%${elem}%" + populateTemplate "$spread" "$template" fi # reset for next page... template= # ignore the rest of the items when we are done # creating two pages... - [ $C == 2 ] \ - && return + if [ $C == 2 ] ; then + populateTemplate_img= + populateTemplate_txt= + return + fi done fi fi @@ -621,6 +656,8 @@ handleSpread(){ fi fi + populateTemplate_img= + populateTemplate_txt= populateTemplate "$spread" "$template" "${img[@]}" "${txt[@]}" return $? diff --git a/macros/latex/contrib/stellenbosch-2/README b/macros/latex/contrib/stellenbosch-2/README index 5205449a4e..26aeee2095 100644 --- a/macros/latex/contrib/stellenbosch-2/README +++ b/macros/latex/contrib/stellenbosch-2/README @@ -1,4 +1,4 @@ - The Stellenbosch-2 bundle v1.0 + The Stellenbosch-2 bundle v2.0 for typesetting dissertations, theses and reports of the Stellenbosch University, South Africa. diff --git a/macros/latex/contrib/stellenbosch-2/doc/CHANGELOG b/macros/latex/contrib/stellenbosch-2/doc/CHANGELOG new file mode 100644 index 0000000000..ad2394e65f --- /dev/null +++ b/macros/latex/contrib/stellenbosch-2/doc/CHANGELOG @@ -0,0 +1,24 @@ +----------------------------------------------------------- +Stellenbosch-2 v2.0 (2023/09/01) +----------------------------------------------------------- + + Documentation bug fixes + + stb-thesis v1.3 + - Remove add to contents before TOC in + Declaration, abstracts and TOC. + + Templates + - Remove add to contents before TOC + - Change \chapters to \chapters* before TOC + - Set \renewcommand\tableofcontents{% + \chapter*{\contentsname}\@starttoc{toc}} + +----------------------------------------------------------- +Stellenbosch-2 v1.0 (2023/08/10) +----------------------------------------------------------- + + First CTAN release + +----------------------------------------------------------- +
\ No newline at end of file diff --git a/macros/latex/contrib/stellenbosch-2/doc/stb-thesis.pdf b/macros/latex/contrib/stellenbosch-2/doc/stb-thesis.pdf Binary files differindex 3b8bf95202..fd8348ba09 100644 --- a/macros/latex/contrib/stellenbosch-2/doc/stb-thesis.pdf +++ b/macros/latex/contrib/stellenbosch-2/doc/stb-thesis.pdf diff --git a/macros/latex/contrib/stellenbosch-2/doc/stellenbosch-2.pdf b/macros/latex/contrib/stellenbosch-2/doc/stellenbosch-2.pdf Binary files differindex cd23dbc416..521309f15d 100644 --- a/macros/latex/contrib/stellenbosch-2/doc/stellenbosch-2.pdf +++ b/macros/latex/contrib/stellenbosch-2/doc/stellenbosch-2.pdf diff --git a/macros/latex/contrib/stellenbosch-2/tex/stb-thesis.cls b/macros/latex/contrib/stellenbosch-2/tex/stb-thesis.cls index 8efaef30f8..162e53b6f4 100644 --- a/macros/latex/contrib/stellenbosch-2/tex/stb-thesis.cls +++ b/macros/latex/contrib/stellenbosch-2/tex/stb-thesis.cls @@ -30,8 +30,8 @@ %% stb-thesis.cls %% ------------------------------------------------------------------- %% -\newcommand{\STBTfileversion}{v1.2} -\newcommand{\STBTfiledate}{2023/08/10} +\newcommand{\STBTfileversion}{v1.3} +\newcommand{\STBTfiledate}{2023/09/01} \NeedsTeXFormat{LaTeX2e}[2020/08/10] \def\STB@basetype{book} \ProvidesClass{stb-thesis}[\STBTfiledate @@ -528,8 +528,8 @@ \thispagestyle{plain}% \chapter*{\DeclarationName}% \declaremark - \phantomsection - \addcontentsline{toc}{chapter}{\DeclarationName}% + %\phantomsection + %\addcontentsline{toc}{chapter}{\DeclarationName}% #1\par \STB@putdecldate \ifSTB@Copyright @@ -555,8 +555,8 @@ \par \chapter*{\AbstractName}% \abstractmark - \phantomsection - \addcontentsline{toc}{chapter}{\AbstractName}% + %\phantomsection + %\addcontentsline{toc}{chapter}{\AbstractName}% \begin{center} {\large\bfseries \@title \par} \medskip @@ -573,6 +573,7 @@ \end{center} \if@restonecol\twocolumn\fi% }{} + \renewcommand\tableofcontents{% \if@twocolumn \@restonecoltrue\onecolumn @@ -581,8 +582,8 @@ \fi \chapter*{\contentsname}% \tocmark - \phantomsection - \addcontentsline{toc}{chapter}{\contentsname}% + %\phantomsection + %\addcontentsline{toc}{chapter}{\contentsname}% \@starttoc{toc}% \if@restonecol\twocolumn\fi} \renewcommand\listoffigures{% |