答案1
您可以只使用嵌套计数器tabular
和新计数器。为了简化操作,您可以为它们定义环境。它们可以自动插入计数器。
\documentclass{article}
\usepackage{array}
\newcounter{logpnumi}
\newcounter{logpnumii}
\newenvironment{LogProof}{\begingroup\sffamily
\setcounter{logpnumi}{0}%
\begin{tabular}{>{\stepcounter{logpnumi}\number\value{logpnumi}.}rll}}{\end{tabular}
\endgroup}
\newenvironment{SubTable}{\begin{tabular}[t]{@{}>{%
\ifnum\value{logpnumii}<1
\else
\the\numexpr\value{logpnumi}+1\relax.\number\value{logpnumii}
\fi
\stepcounter{logpnumii}
}lll}}
{\end{tabular}\setcounter{logpnumii}{0}}
\begin{document}
\begin{LogProof}
& $\lnot s\to r$ & Given\\
& $(r\lor p)\to q$ & Given\\
& \begin{SubTable}
$r\to q$ \\
& $\lnot s$ & Assumption\\
& $r$ & MP4.1
\end{SubTable} & $\land$ Elim:2\\
& \begin{SubTable}
$\lnot s\to q$ \\
& $s$ & Assumption\\
& $s\to(p\land q)$ & Given
\end{SubTable} & Direct proof rule\\
& $s\to q$ & [Direct proof rule]\\
\end{LogProof}
\end{document}
答案2
您可以将enumii
编号重新定义为一个表达式,该表达式采用前一个数字的增量enumi
。请注意,的参数\numexpr
应以 结尾\relax
。这将被吞噬,\numexpr
以确保它不会进一步扫描更多数字。
\documentclass{article}
\renewcommand{\labelenumii}{\theenumii}
\renewcommand*\theenumii{\the\numexpr(\value{enumi}+1)\relax.\arabic{enumii}}
\begin{document}
\begin{enumerate}
\item First
\begin{enumerate}
\item Second
\item Third
\end{enumerate}
\item Fourth
\item Fifth
\end{enumerate}
\end{document}