Skip to content

Commit e43d6c2

Browse files
committed
add refformat option
1 parent 001ca71 commit e43d6c2

2 files changed

Lines changed: 45 additions & 26 deletions

File tree

fitch.sty

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
% \]
5151

5252
\NeedsTeXFormat{LaTeX2e}
53-
\ProvidesPackage{fitch}[2023-10-15 v1.0-beta Macros for Fitch-style natural deduction]
53+
\ProvidesPackage{fitch}[2023-10-15 v1.0-beta2 Macros for Fitch-style natural deduction]
5454

5555
% Define keyval options
5656

@@ -64,6 +64,7 @@ prefix = nd@ % prefix with nd@ for compatibility with old code
6464
\DeclareStringOption[ndrules]{rules}
6565
\DeclareStringOption[array]{arrayenv}
6666
\DeclareStringOption[ndjustformat]{justformat}
67+
\DeclareStringOption[ndrefformat]{refformat}
6768

6869
\DeclareStringOption[4.5ex]{height}[4.5ex]
6970
\DeclareStringOption[3.5ex]{topheight}[3.5ex]
@@ -94,6 +95,7 @@ prefix = nd@ % prefix with nd@ for compatibility with old code
9495
rules,
9596
arrayenv,
9697
justformat,
98+
refformat,
9799
height,
98100
topheight,
99101
depth,
@@ -122,7 +124,7 @@ prefix = nd@ % prefix with nd@ for compatibility with old code
122124
\def\nd@numopt#1#2{\nd@numo{$#1$}{#2}}
123125
\def\nd@numo#1#2{\edef\x{#1}\mbox{$\x$}\expandafter\global\expandafter\let\csname nd@-#2\endcsname\x}
124126
\def\nd@ref#1{\expandafter\let\expandafter\x\csname nd@-#1\endcsname\ifx\x\relax%
125-
\PackageWarning{fitch}{Undefined line reference: #1}\mbox{\textbf{??}}\else\mbox{$\x$}\fi}
127+
\PackageWarning{fitch}{Undefined line reference: #1}\mbox{\textbf{??}}\else\csname\nd@refformat\endcsname{\mbox{$\x$}}\fi}
126128
\def\nd@noop{}
127129
\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}
128130
\def\nd@reset{\nd@set{}{1}}
@@ -286,6 +288,10 @@ prefix = nd@ % prefix with nd@ for compatibility with old code
286288

287289
\newcommand{\ndjustformat}[2]{#1, #2}
288290

291+
% default line number format
292+
293+
\newcommand{\ndrefformat}[1]{#1}
294+
289295
% User-level commands for proofs
290296

291297
\newenvironment{nd}[1][]

fitchdoc.tex

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
\href{https://github.com/OpenLogicProject/fitch/issues}{issues} with
5656
it.}}
5757

58-
\date{Version 1.0-beta\\ October 15, 2023}
58+
\date{Version 1.0-beta2\\ October 15, 2023}
5959

6060
\begin{document}
6161
\maketitle
@@ -256,14 +256,14 @@ \subsection{Generic justifications}
256256
257257
\subsection{Scope}
258258
259-
The commands |\hypo|, |\have|, |\open|, |\close|,
260-
|\r|, |\ii|, and so forth are only available inside an
261-
|nd| environment. These commands may have a different meaning
262-
elsewhere in the same document. The only commands provided by the
263-
|fitch.sty| package which are visible outside an |nd|
264-
environment are the command |\ndref| described in
265-
Section~\ref{subsec-ndref}, and the command |\nddim| and the
266-
dimension |\ndindent| described in Section~\ref{sec-customization}.
259+
The commands |\hypo|, |\have|, |\open|, |\close|, |\r|, |\ii|, and so
260+
forth are only available inside an |nd| environment. These commands
261+
may have a different meaning elsewhere in the same document. The only
262+
commands provided by the |fitch.sty| package which are visible
263+
outside an |nd| environment are the command |\ndref| described in
264+
Section~\ref{subsec-ndref}, the commands |\ndrules|, |\ndjustformat|,
265+
|\ndrefformat|, and |\nddim|, and the dimension |\ndindent| described
266+
in Section~\ref{sec-customization}.
267267
268268
\subsection{Breaking it across pages}\label{subsec-break}
269269
@@ -433,15 +433,17 @@ \section{Customization}\label{sec-customization}
433433
\begin{fitchproof}[linethickness=1pt]
434434
\fitchset{hsep=1em,indent=1em}\end{verbatim}
435435
436-
In addition, the macros used
437-
to generate the table containing the proof,
438-
to format justifications, and to initialize macros to produce
439-
justifications in the proof can be customized:
436+
In addition, the macros used to generate the table containing the
437+
proof, to format justifications, format line number references, and to
438+
initialize macros to produce justifications in the proof can be
439+
customized:
440440
\begin{center}
441441
\begin{tabular}{ll}
442-
\meta{rules} & |ndrules|\\
443-
\meta{justformat} & |ndjustformat|\\
444-
\meta{arrayenv} & |array|
442+
option & default\\\hline
443+
|rules=|\meta{macroname} & |ndrules|\\
444+
|justformat=|\meta{macroname} & |ndjustformat|\\
445+
|refformat=|\meta{macroname} & |ndrefformat|\\
446+
|arrayenv=|\meta{envname} & |array|
445447
\end{tabular}
446448
\end{center}
447449
For compatibility with earlier versions of |fitch.sty|, the default
@@ -483,23 +485,34 @@ \section{Customization}\label{sec-customization}
483485
\newcommand{\ndjustformat}[2]{#1, #2}
484486
\end{verbatim}
485487
The first argument takes the rule name, the second the reference list.
488+
It is used to typeset the justification.
486489
487-
\cmd{\ndrules} and \cmd{\ndjustformat} can be redefined using
488-
\cmd{\renewcommand}, or you can define your own commands to set the
489-
rule names or the justification format, and pass the names (without
490-
initial |\|) as an option to the \cmd{\usepackage} or individual
491-
\cmd{\nd} or \cmd{\fitchproof} commands.
490+
\DescribeMacro{\ndrefformat}
491+
The macro \cmd{\ndrefformat} is defined as
492+
\begin{verbatim}
493+
\newcommand{\ndrefformat}[1]{#1}
494+
\end{verbatim}
495+
It is used to typeset the line numbers in justifications.
496+
497+
\cmd{\ndrules}, \cmd{\ndjustformat}, and \cmd{\ndrefformat} can
498+
be redefined using \cmd{\renewcommand}, or you can define your own
499+
commands to provide the rule names, the justification format, and line
500+
number format, and pass the names (without initial |\|) as an option
501+
to the \cmd{\usepackage} or individual \cmd{\nd} or \cmd{\fitchproof}
502+
commands.
492503
\begin{LTXexample}
493504
\newcommand{\myjust}[2]
494-
{#2 (by \textsf{#1})}
505+
{#2 by \textsf{#1}}
495506
\newcommand{\myrules}{
496507
\ndrules % include standard rules
497508
\def\ds{\by{DS}}}
509+
\renewcommand{\ndrefformat}[1]{(#1)}
498510
$
499511
\begin{nd}[rules=myrules,
500512
justformat=myjust,
501-
indent=2cm,
502-
linethickness=1.5pt]
513+
indent=1.5cm,
514+
linethickness=1.5pt,
515+
justsep=1cm]
503516
\hypo {1} {A\vee B}
504517
\hypo {2} {\neg B}
505518
\open

0 commit comments

Comments
 (0)