# lplfitch package : Add line numbering on the left

I am using the package lplfitch to typeset natural deduction proofs in Fitch style. I would like to number the lines on the left side of the vertical bar instead of on the left of the formula?

Schematically, here is what I'd like to get:

1. |  hypothesis_1
2. |  hypothesis_2
3. |_  hypothesis_3
3. |  deduction_1     rule_1
4. |  deduction_2     rule_2
5. |  deduction_3     rule_3
6. |  deduction_4     rule_4
7. |  deduction_5     rule_5


Here is a working example:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{lplfitch}
\begin{document}
\fitchprf{
\pline[1.]{\forall x (Fx\supset Axf)}[H]\\
\pline[2.]{\forall x(Fx\supset Afx)}[H]\\
\pline[3.]{Fi}[H]}{
\pline[4.]{Fi\supset Aif}[\lalle{1, i}]\\
\pline[5.]{Aif}[\life{3}{4}]\\
\pline[6.]{Fi\supset Afi}[\lalle{2, i}]\\
\pline[7.]{Afi}[\life{5}{6}]\\
\pline[8.]{Aif\land Afi}[\landi{5}{7}]
}
\end{document}


It produces something like this:

| 1. hypothesis_1
| 2. hypothesis_2
|_3. hypothesis_3
| 4. deduction_1     rule_1
| 5. deduction_2     rule_2
| 6. deduction_3     rule_3
| 7. deduction_7     rule_4
| 8. deduction_8     rule_5


This answer demonstrates how to use fitch to typeset the proof in the question, which puts the line numbers to the left of the line, and how to modify the nd environment so that the inference rules defined use the appropriate symbols for the logical connectives.

By default, the package hard-codes these symbols and uses e.g. \wedge rather than the semantic \land. For the conditional, it uses \Rightarrow. In this case, there is no semantic alternative. Rather than hard-coding the horseshoe with \supset, we add an additional semantic macro, \lif and use that.

The only tricky part of this involves the cat code changes and that's only difficult because I don't know what I'm doing. However, copy-pasting from the .sty works wonders.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fitch}
% modified from fitch.sty
{\chardef\x=\catcode\*
\catcode\*=11
\global\let\nd*astcode\x}
\catcode\*=11
\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{$\lif$I}}%
\def\ie{\by{$\lif$E}}%
\def\Ai{\by{$\forall$I}}%
\def\Ae{\by{$\forall$E}}%
\def\Ei{\by{$\exists$I}}%
\def\Ee{\by{$\exists$E}}%
\def\ai{\by{$\land$I}}%
\def\ae{\by{$\land$E}}%
\def\ai{\by{$\land$I}}%
\def\ae{\by{$\land$E}}%
\def\oi{\by{$\lor$I}}%
\def\oe{\by{$\lor$E}}%
\def\ni{\by{$\lnot$I}}%
\def\ne{\by{$\lnot$E}}%
\def\be{\by{$\bot$E}}%
\def\nne{\by{$\lnot\lnot$E}}%
\def\r{\by{R}}%
}
\catcode\*=\nd*astcode
\let\lif\supset
\begin{document}
$\begin{nd} \hypo {1} {\forall x (Fx\lif Axf)} \hypo {2} {\forall x(Fx\lif Afx)} \hypo {3} {Fi} \have {4} {Fi\lif Aif} \Ae{1} \have {5} {Aif} \ie{3,4} \have {6} {Fi\lif Afi} \Ae{2} \have {7} {Afi} \ie{3,6} \have {8} {Aif\land Afi} \ai{5,7} \end{nd}$
\end{document}