我在读这发表关于如何使用自定义“步骤”(列表)环境的帖子,其中每个步骤\item
都会引入一个“步骤”并增加计数器。但是,我不知道缩进列表的最佳方式是什么,以便它与其他每个段落对齐,如下所示:
原来的
我想要的是:
我的代码:
\usepackage{enumitem}
\newlist{steps}{enumerate}{1}
\setlist[steps, 1]{leftmargin=\parindent, label=\bfseries{Step \arabic*}:}
\begin{steps}
\item Start program.
\item Move value FFH to accumulator A.
\item Move value 01H to register B.
\item Move value 00H to register C.
\item Add contents of register B to accumulator.
\item If carry bit is 0, increment C, else continue.
\item Store accumulator data at address 8050H.
\item Move contents of register C to accumulator.
\item Store accumulator data at address 8051H.
\item End program.
\end{steps}
我想做的两件事是:
- 将列表与所有其他段落对齐:我试过了,
\parindent
但它不起作用 - 我不想将它硬编码为某些值,如2cm
m 等。 - 如果可能的话,按首字母对齐
S
,而不是:
稍微Step 10
向前移动。
有任何想法吗 ?
答案1
给你:
\documentclass{article}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness} {0.3pt}
\usepackage{enumitem}
\newlist{steps}{enumerate}{1}
\setlist[steps, 1]{wide=0pt, leftmargin=\parindent, label=Step \arabic*:, font=\bfseries}
\begin{document}
\begin{steps}
\item Start program.
\item Move value FFH to accumulator A.
\item Move value 01H to register B.
\item Move value 00H to register C.
\item Add contents of register B to accumulator.
\item If carry bit is 0, increment C, else continue.
\item Store accumulator data at address 8050H.
\item Move contents of register C to accumulator.
\item Store accumulator data at address 8051H.
\item End program.
\end{steps}
\end{document}