穿插步骤编号

穿插步骤编号

我正在寻找一个包或一种方法来处理整个文档中任意间隔的项目的编号,然后可以在文档的后面引用。

我的具体情况是,我有一份说明文件,我想用数字标记所有测量步骤(像各个部分一样自动递增的数字),这样我就可以在专门用于记录测量结果的页面上引用该数字。

我无法弄清楚如何创建一个环境来处理这个问题,因为这些项目并不都在一起。

代码示例。

\newenvironment{zz} %formating for section content, subsections, and their content
               {\list{}{
               \leftmargin=0.3in
               \rightmargin=0in
               \itemindent=0in
               \listparindent=0in
               }
               \item\relax}
               {\endlist}

\newenvironment{yy} %formating for subsubsections and their content
               {\list{}{
               \leftmargin=0in
               \rightmargin=0in
               \itemindent=0in
               \listparindent=0in}
               \item\relax
               }
               {\endlist}

\begin{document}
\HereIsSomeTitleStuff

\section{Instructions}
\begin{zz}
Its time for some background text. Leorium uipsume bla bla bla

\subsection{category A}

Here is some details on it.

More details and instructions

Measurement!!!!

More details

\subsection{category B}

Here is some details on it.

More details and instructions

Measurement!!!!

More details

\subsection {category C}

Here is some details on it.

More details and instructions

Measurement!!!!

More details

\end{zz}

\section{Intermediate part of the document}
\begin{zz}

Bla bla bla classified info goes here.

\end{zz}
\section{report forum}
\begin{zz}

space for first measurement

space for second measurement

space for third measurement
\end{zz}
\end document

看看我在哪里有“测量!!!”。我希望它们在最终的 .pdf 中被编号,这样我就可以在报告表格中引用“步骤”编号。{zz}用于段落格式(缩进、悬挂缩进)。

答案1

以下是您测量的开始参考:

enter image description here

\documentclass{article}
\newcounter{measurement}
\newenvironment{measurement}
  {\par\refstepcounter{measurement}\noindent
   \textbf{Measurement~\themeasurement:}\quad\ignorespaces}
  {\ignorespacesafterend}
\begin{document}
\section{Instructions}
Its time for some background text. Leorium uipsume bla bla bla

\subsection{category A}

Here is some details on it.

More details and instructions

\begin{measurement}
Measurement!!!! \label{measurement1}
\end{measurement}

More details

\subsection{category B}

Here is some details on it.

More details and instructions

\begin{measurement}
Measurement!!!! \label{measurement2}
\end{measurement}

More details

\subsection {category C}

Here is some details on it.

More details and instructions

\begin{measurement}
Measurement!!!! \label{measurement3}
\end{measurement}

More details

\section{Intermediate part of the document}

Bla bla bla classified info goes here.

\section{report forum}

\begin{measurement}
space for first measurement. See measurement~\ref{measurement1}.
\end{measurement}

\begin{measurement}
space for second measurement. See measurement~\ref{measurement2}.
\end{measurement}

\begin{measurement}
space for third measurement. See measurement~\ref{measurement3}.
\end{measurement}
\end{document}

这是一个非常基本的实现,它使用一个横跨整个文档的计数器。如果您希望更改计数器的外观,请更新\themeasurement。如果您希望使用(例如)重置计数器\section,也可以这样做。

相关内容