答案1
以下代码极大地得益于 gernot 对问题的回答逻辑条件证明 (cp) 箭头。
\suppose
、、\consequenceofsupposition
和\arrow
(如下所定义)用于由 CP(条件证明)证实的推论。
\documentclass{article}
\usepackage{calc}
\usepackage{amssymb} % defines \therefore
\usepackage{tikz}
\let\impl\supset
\newcounter{lineno} % as in ``line number''
\newcommand{\copiproof}[1]{\begin{center}\begin{tabular}{rll}\setcounter{lineno}{0}#1\end{tabular}\end{center}} % after Irving Copi
\newcommand{\premise}[1]{\addtocounter{lineno}{1}\thelineno. & $#1$\\}
\newcommand{\premiseandclaim}[2]{%
\addtocounter{lineno}{1}\thelineno. & $#1$ \rlap{\quad$/\therefore #2$}\\}
\newcommand{\assert}[2]{\addtocounter{lineno}{1}\thelineno. & $#1$ & #2\\}
\newcommand\tikznode[3][]{%
\tikz[remember picture,baseline=(#2.base)]
\node[minimum size=0pt,inner sep=0pt,#1](#2){#3};%
}
\newcommand{\suppose}[1]{\addtocounter{lineno}{1}\tikznode{A}{\thelineno.} & $#1$\\}
\newcommand{\consequenceofsupposition}[4]{\addtocounter{lineno}{1}\thelineno. & \tikznode{B}{$#1\impl(#2)$\strut} & $#3$--$#4$, C.P.\\} % The first argument: the supposition. The second argument: the consequence of the supposition. The third argument: The line number of the supposition. The fourth argument: The line number of the consequence of the supposition.
\newcommand{\arrow}{%
\begin{tikzpicture}[remember picture,overlay]
\draw[stealth-,shorten <=2pt] (A) -- ++(-1.5em,0) |- (B.north east);
\end{tikzpicture}
}
\begin{document}
%%% Example skeleton:
\copiproof{
\premise{first premise}
\premise{second premise}
\premiseandclaim{third premise}{claim}
\assert{first assertion}{justification}
\assert{second assertion}{justification}
\assert{third assertion}{justification}
}
%%% gernot's code:
\begin{center}
\begin{tabular}{rll}
1. & $A\impl B$ \rlap{\quad$/\therefore A\impl (A\cdot B)$}\\
\tikznode{A}{2.} & $A$ & supuesto \\
3. & $B$ & $1$, $2$, M.P.\\
4. & $A\cdot B$ & $2$, $3$, Conj.\\
5. & \tikznode{B}{$A\impl(A\cdot B)$\strut} & $2$--$4$, C.P.
\end{tabular}
\end{center}
\begin{tikzpicture}[remember picture,overlay]
\draw[stealth-,shorten <=2pt] (A) -- ++(-1.5em,0) |- (B.north east);
\end{tikzpicture}
%%% Mechanized version of gernot's code:
\copiproof{
\premiseandclaim{A\impl B}{A\impl (A\cdot B)}
\suppose{A}
\assert{B}{1, 2, M.P.}
\assert{A\cdot B}{2, 3, Conj.}
\consequenceofsupposition{A}{A\cdot B}{2}{4}
\arrow
}
\end{document}
答案2
{NiceTabular}
这是使用和 TikZ 的解决方案,nicematrix
使用创建的 TikZ 节点绘制箭头nicematrix
。
\documentclass{article}
\usepackage{amssymb} % for \therefore
\usepackage{nicematrix,tikz}
\usetikzlibrary{arrows.meta,ext.paths.ortho} % for "r-lr"
\begin{document}
\begin{NiceTabular}{rll}
1. & $A\supset B$ \rlap{\quad$/\therefore A\supset (A\cdot B)$}\\
2. & $A$ & supuesto \\
3. & $B$ & $1$, $2$, M.P.\\
4. & $A\cdot B$ & $2$, $3$, Conj.\\
5. & $A\supset(A\cdot B)$ & $2$--$4$, C.P.
\CodeAfter \tikz \draw [<-,shorten < = 2pt] (2-1) r-lr ([yshift=1pt]5-|3);
\end{NiceTabular}
\end{document}