You can pretty easily highlight the relevant part of the proof using a box by placing tikzmark
s appropriately and drawing a tikzpicture
afterwards.
For example,
\documentclass{article}
% ateb: https://tex.stackexchange.com/a/700683/ i gwestiwn Bernhard: https://tex.stackexchange.com/q/700671/
\usepackage{fitch}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{fit}
\usetikzlibrary{calc}
\begin{document}
\begin{displaymath}
\begin{nd}
\hypo {1} {P \lor Q} \by{}{}%
\hypo {2} {P \rightarrow R} \by{}{}%
\hypo {3} {Q\tikzmark{a} \rightarrow R} \by{}{}%
\open
\hypo {4} {\tikzmarknode{b}{P}} \by{}{}
\have {5} {\tikzmarknode{c}{R}} \by{\tikzmarknode{d}{\strut}}{}
\close
\open
\hypo {6} {Q} \by{}{}%
\have {7} {R} \by{}{}%
\close
\have {8} {R} \by{}{}%
\end{nd}
\end{displaymath}
\begin{tikzpicture}[remember picture,overlay]
\node [fit=({pic cs:a} |- b) (b) (c) ($(d.south)!.75!(c |- d.south)$),draw=red] {};
\end{tikzpicture}
\end{document}
If you actually want to shade that part of the proof, as opposed to drawing around it, things are considerably trickier. Until the proof is constructed, you don't know where to shade; after it is constructed, you can't easily shade beneath it.
One approach would be to put the proof inside a tikzpicture
. Then we can use the backgrounds
library to shade the relevant sub-proof after the proof is constructed. For example,
\documentclass{article}
% ateb: https://tex.stackexchange.com/a/700683/ i gwestiwn Bernhard: https://tex.stackexchange.com/q/700671/
\usepackage{fitch}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{fit}
\usetikzlibrary{calc}
\usetikzlibrary{backgrounds}
\begin{document}
\begin{tikzpicture}[remember picture]
\node [align=center] {%
$\begin{nd}
\hypo {1} {P \lor Q} \by{}{}%
\hypo {2} {P \rightarrow R} \by{}{}%
\hypo {3} {Q\tikzmark{e} \rightarrow R} \by{}{}%
\open
\hypo {4} {\subnode{f}{P}} \by{}{}
\have {5} {\subnode{g}{R}} \by{\subnode{h}{\strut}}{}
\close
\open
\hypo {6} {Q} \by{}{}%
\have {7} {R} \by{}{}%
\close
\have {8} {R} \by{}{}%
\end{nd}$
};
\scoped[on background layer]
{
\node [fit=({pic cs:e} |- f) (f) (g) ($(h.south)!.75!(g |- h.south)$),fill=cyan!25] {};
}
\end{tikzpicture}
\end{document}
standalone
here.