MWE 如下:
\documentclass{article}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{logicproof}
\usepackage{etoolbox}
%%%make logic proof lines ragged left%%%%%%%%%%%%%%%%%%%
\patchcmd{\logicproof}{\center}{\flushleft}{}{}
\patchcmd{\endlogicproof}{\endcenter}{\endflushleft}{}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{logicproof}{1}
\forall x \, (P(x) \to Q(x)) & premise \label{cxy}\\
\forall x \, P(x) & premise \\
P(x_0) \to Q(x_0) & $\forall x \, \mathrm{e}$ 1 \\
P(x_0) & $\forall x \, \mathrm{e}$ 2 \\
Q(x_0) & $\to \mathrm{e}$ 3, 4 and so on \eqref{cxy}\\
\forall x \, Q(x) & $\forall x \, \mathrm{i}$ 3--5
\end{logicproof}
\end{document}
它的输出是
我的问题是如何使逻辑证明的行数加括号,如(1)、(2)、(3)等?我尝试了几次,但不幸失败了。
欢迎任何回复!
答案1
保存校样中行号格式的宏是\lp@start@proof@line
。您只需重新定义它:
\renewcommand{\lp@start@proof@line}{%
\stepcounter{lp@line}%
(\arabic{lp@line})%
&%
\lp@continue@proof@line%
}
\documentclass{article}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{logicproof}
\usepackage{etoolbox}
%%%make logic proof lines ragged left%%%%%%%%%%%%%%%%%%%
\patchcmd{\logicproof}{\center}{\flushleft}{}{}
\patchcmd{\endlogicproof}{\endcenter}{\endflushleft}{}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\renewcommand{\lp@start@proof@line}{%
\stepcounter{lp@line}%
(\arabic{lp@line})%
&%
\lp@continue@proof@line%
}
\makeatother
\begin{document}
\begin{logicproof}{1}
\forall x \, (P(x) \to Q(x)) & premise \label{cxy}\\
\forall x \, P(x) & premise \\
P(x_0) \to Q(x_0) & $\forall x \, \mathrm{e}$ 1 \\
P(x_0) & $\forall x \, \mathrm{e}$ 2 \\
Q(x_0) & $\to \mathrm{e}$ 3, 4 and so on \eqref{cxy}\\
\forall x \, Q(x) & $\forall x \, \mathrm{i}$ 3--5
\end{logicproof}
\end{document}