我经常使用 lplfitch 包来编写证明。有没有办法自动对演示行进行编号?目前,我使用参数 \pline[NUMBERING]{....} 手动输入编号
\documentclass[11pt]{article}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{lplfitch}
\renewcommand*{\formula}[1]{\ensuremath{#1}}
\begin{document}
\fitchprf{\pline[1.]{P \rightarrow Q}\\\pline[2.]{P}}
{\pline[3.]{Q}}
\end{document}
编辑:嗨,Simone,只要你不使用 subproof,你的解决方案就很好。不幸的是,使用 subproof 后,编号在某些时候会重新从 1 开始。请看:
\fitchprf{\pline{P \lif Q}} {\subproof{\pline{P}} {\pline{Q}\\\pline{Q \lor R}}\pline{P \lif (Q \lor R)} }
答案1
试试这个代码。没有可选参数\pline
将添加一个连续的数字。
来自手册第 9 页的示例:subproof
3 级深度。
\documentclass[11pt]{article}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{lplfitch}
\renewcommand*{\formula}[1]{\ensuremath{#1}}
%******************************* added <<<<<<<<<<
\newcounter{countline}
\newcounter{oldcountline}
\usepackage{xpatch}
\makeatletter
\def\pline{\@ifnextchar[\@plinenum{\@plinenum[\stepcounter{countline}\thecountline.]}}% format the line numbers
\xapptocmd{\fitchprf}{\setcounter{oldcountline}{\thecountline}\setcounter{countline}{0}}{}{}% reset the counter for a new proof
\renewcommand{\subproof}[2]{&\fitchprf{#1}{#2}\\\setcounter{countline}{\theoldcountline}} % continue the sequence if subproof
\makeatother
%*******************************
\begin{document}
manual numbering
\fitchprf{\pline[1.]{P \rightarrow Q}\\\pline[2.]{P}}
{\pline[3.]{Q}}
\bigskip
with auto numbering
\fitchprf{\pline{P \rightarrow Q}\\
\pline{P}}
{\pline{Q}}
\bigskip
a new proof
\fitchprf{\pline{R \rightarrow S}\\
\pline{R}}
{\pline{T}}
\bigskip
subproof with auto numbering
\fitchprf{\pline{P \lif Q}} {
\subproof{\pline{P}}
{\pline{Q}\\
\pline{Q \lor R}}
\pline{P \lif (Q \lor R)}
}
\newpage
subproof with manual numbering
\fitchprf{}{
\subproof{\pline[1.]{\uni{x}{(Cube(x)\lif Small(x))}}}{
\subproof{\pline[2.]{\exi{x}{Cube(x)}}}{
\subproof{\pline[3.]{Cube(a)}}{
\pline[4.]{Cube(a)\lif Small(a)}\\
\pline[5.]{Small(a)}\\
\pline[6.]{\exi{x}{Small(x)}}
}
\pline[7.]{\exi{x}{Small(x)}}
}
\pline[8.]{\exi{x}{Cube(x)}\lif \exi{x}{Small(x)}}
}
\pline[9.]{\brokenform{(\uni{x}{(Cube(x)\lif Small(x))}\lif}{
\formula{(\exi{x}{Cube(x)} \lif \exi{x}{Small(x)})}}}
}
\bigskip
subproof with auto numbering
\fitchprf{}{
\subproof{\pline{\uni{x}{(Cube(x)\lif Small(x))}}}{
\subproof{\pline{\exi{x}{Cube(x)}}}{
\subproof{\pline{Cube(a)}}{
\pline{Cube(a)\lif Small(a)}\\
\pline{Small(a)}\\
\pline{\exi{x}{Small(x)}}
}
\pline{\exi{x}{Small(x)}}
}
\pline{\exi{x}{Cube(x)}\lif \exi{x}{Small(x)}}
}
\pline{\brokenform{(\uni{x}{(Cube(x)\lif Small(x))}\lif}{
\formula{(\exi{x}{Cube(x)} \lif \exi{x}{Small(x)})}}}
}
\end{document}