我找到“协议”环境在 Latex 中编写协议。
问题是,当要添加到协议中的项目列表太长时,这些项目会在同一页面上延续,因此会隐藏很多次。
有没有办法确保新环境能够处理长列表?特别是无需手动拆分列表?
以下是一个例子:
\documentclass{article}
\usepackage{tabularx}
\usepackage{siunitx}
\usepackage{textcomp}
\usepackage{longtable}
\newcommand\Tstrut{\rule{0pt}{1.9\normalbaselineskip}}
\newcommand\Bstrut{\rule[-0.10ex]{0pt}{0pt}}
\renewcommand{\labelenumii}{\theenumii}
\renewcommand{\theenumii}{\theenumi.\arabic{enumii}.}
\newcounter{protocol}
\newenvironment{protocol}[1]
{\par\addvspace{\topsep}
\noindent
\tabularx{\linewidth}{@{} X @{}}
\hline
\Tstrut
\refstepcounter{protocol}\textbf{Protocol \theprotocol} #1 \\
\Bstrut\\
\hline
\\}
{ \\
\hline
\endtabularx
\par\addvspace{\topsep}}
\newcommand{\sbline}{\\[.5\normalbaselineskip]}% small blank line
\begin{document}
\begin{protocol}{extraction}
\begin{enumerate}
\item
Section 1
\begin{enumerate}
\item
\item
\item
\item
\item
\item
\item
\end{enumerate}
\item
Section 2
\begin{enumerate}
\item
\item
\item
\item
\item
\item
\item
\item
\item
\item
\item
\begin{enumerate}
\item
\item
\begin{enumerate}
\item
\end{enumerate}
\item
\item
\item
\item
\item
\end{enumerate}
\item
\item
\item
\end{enumerate}
\item
Section 3
\begin{enumerate}
\item
test
\begin{enumerate}
\item
set
\item
\item
ets
\item
ste
\item
tset
\item
est
\item
This item is shown
\item
This item is hidden
\item
\end{enumerate}
\item
\begin{enumerate}
\item
\item
\item
\item
\item
\item
\item
\item
\item
\item
\item
\end{enumerate}
\end{enumerate}
\item
Section 4
\begin{enumerate}
\item
\item
\item
\end{enumerate}
\end{enumerate}
\end{protocol}
\end{document}
答案1
谢谢 @伯纳德用于输入。它看起来是这样的。唯一的问题是它不是“自动分页”,但它完成了工作!
\documentclass{article}
\usepackage{tabularx}
\usepackage{xltabular}
\usepackage{siunitx}
\usepackage{textcomp}
\usepackage{longtable}
\usepackage{array}
\usepackage{enumitem}
\newcommand\Tstrut{\rule{0pt}{1.9\normalbaselineskip}}
\newcommand\Bstrut{\rule[-0.10ex]{0pt}{0pt}}
\renewcommand{\labelenumii}{\theenumii}
\renewcommand{\theenumii}{\theenumi.\arabic{enumii}.}
\newcounter{protocol}
\newenvironment{protocol}[1]
{\par\addvspace{\topsep}
\noindent
\xltabular{\linewidth}{@{} X @{}}
\hline
\Tstrut
\refstepcounter{protocol}\textbf{Protocol \theprotocol} #1 \\
\Bstrut\\
\hline
\\}
{ \\
\hline
\endxltabular
\par\addvspace{\topsep}}
\newcommand{\sbline}{\\[.5\normalbaselineskip]}% small blank line
\begin{document}
\begin{protocol}{extraction}
\begin{enumerate}[series=TE]
\item
Section 1
\begin{enumerate}
\item
\item
\item
\item
\item
\item
\item
\end{enumerate} % sect 1
\item
Section 2
\begin{enumerate}
\item
\item
\item
\item
\item
\item
\item
\item
\item
\item
\item
\begin{enumerate}
\item
\item
\begin{enumerate}
\item
\end{enumerate}
\item
\item
\item
\item
\item
\end{enumerate}
\item
\item
\item
last item in here.
\end{enumerate} % section 2
\end{enumerate} \\
\begin{enumerate}[resume*=TE]
\item
Section 3
\begin{enumerate}
\item
test
\begin{enumerate}
\item
set
\item
\item
ets
\item
ste
\item
tset
\item
est
\item
This item is shown
\item
This item is not hidden anymore.
\item
\end{enumerate}
\item
\begin{enumerate}
\item
\item
\item
\item
\item
\item
\item
\item
\item
\item
\item
\end{enumerate}
\end{enumerate}
\item
Section 4
\begin{enumerate}
\item
\item
\item
\end{enumerate}
\end{enumerate}
\end{protocol}
\end{document}