This question appears to be dead, but in case somebody wanders across it as I did, there is also the paralistpackage which provides asparaitem and asparaenum environments, which do precisely this.
paralist also provides the inparaenum environment, which is designed for in-paragraph lists: something like "There are three ways to get there: one can (1) turn left, (2) turn right, or (3) go straight." You could use this environment and if you want you can insert your own paragraph breaks. This gives a flush enumerate but with indentation at the beginning of a paragraph. If it comes to that, maybe you should just use \paragraph.
\documentclass{article}
\begin{document}
\section*{Paragraph}
\paragraph{1.} First
\paragraph{2.} Second
\paragraph{3.} Third
\section*{list}
\newcounter{itemcounter}
\begin{list}
{\textbf{\arabic{itemcounter}.}}
{\usecounter{itemcounter}\leftmargin=1.4em}
\item First
\item Second
\item Third
\end{list}
\section*{enumerate with leftmargin}
\begin{enumerate}
\renewcommand{\labelenumi}{\textbf{\theenumi}.}
\setlength{\leftmargin}{0pt}
\item First
\item Second
\item Third
\end{enumerate}
\end{document}
I compiled the three suggested methods into one file to be able to compare them side by side. Note that \setlength{\leftmargin}{0pt} does not have any effect on the enumerate environment. So far, the best solution is the list environment using the option \leftmargin=1.4em. However, I do not like a constant number in my code for it makes the code fragile. Does anyone know how to compute this constant (1.4em) in terms of available LaTeX variables?
\documentclass{article}
\begin{document}
\section*{Paragraph}
\paragraph{1.} First
\paragraph{2.} Second
\paragraph{3.} Third
\section*{list}
\newcounter{itemcounter}
\begin{list}
{\textbf{\arabic{itemcounter}.}}
{\usecounter{itemcounter}\leftmargin=1.4em}
\item First
\item Second
\item Third
\end{list}
\section*{enumerate with leftmargin}
\begin{enumerate}
\renewcommand{\labelenumi}{\textbf{\theenumi}.}
\setlength{\leftmargin}{0pt}
\item First
\item Second
\item Third
\end{enumerate}
\end{document}
发布评论
评论(3)
您最好的选择可能是使用
mdwlist
包或enumlist
包。或者此网站建议使用
列表 环境如下:
这表明您可以根据需要重新定义枚举中的长度
leftmargin
。比如:这似乎对我有用..
Your best bet is probably to use either the
mdwlist
package or theenumlist
package.Or this website suggests the use of the
list
environment like this:which suggests that you could redefine the length
leftmargin
in your enumeration if you prefer. Something like:which seems to work for me..
这个问题似乎已经死了,但如果有人像我一样徘徊在这个问题上,还有
paralist
package 提供了asparaitem
和asparaenum
环境,正是这样做的。paralist
还提供了inparaenum
环境,该环境专为段落内列表而设计:类似于“有三种方法可以到达那里:一种可以 (1) 向左转,( 2)右转,或(3)直走。”您可以使用此环境,如果您愿意,您可以插入自己的段落分隔符。这给出了齐平的枚举,但在段落的开头有缩进。如果涉及到这一点,也许你应该使用\paragraph
。This question appears to be dead, but in case somebody wanders across it as I did, there is also the
paralist
package which providesasparaitem
andasparaenum
environments, which do precisely this.paralist
also provides theinparaenum
environment, which is designed for in-paragraph lists: something like "There are three ways to get there: one can (1) turn left, (2) turn right, or (3) go straight." You could use this environment and if you want you can insert your own paragraph breaks. This gives a flush enumerate but with indentation at the beginning of a paragraph. If it comes to that, maybe you should just use\paragraph
.我将三种建议的方法编译到一个文件中,以便能够并排比较它们。请注意,
\setlength{\leftmargin}{0pt}
对enumerate
环境没有任何影响。到目前为止,最好的解决方案是使用选项\leftmargin=1.4em
的list
环境。但是,我不喜欢代码中的常量,因为它会使代码变得脆弱。有谁知道如何根据可用的 LaTeX 变量计算这个常数 (1.4em
)?I compiled the three suggested methods into one file to be able to compare them side by side. Note that
\setlength{\leftmargin}{0pt}
does not have any effect on theenumerate
environment. So far, the best solution is thelist
environment using the option\leftmargin=1.4em
. However, I do not like a constant number in my code for it makes the code fragile. Does anyone know how to compute this constant (1.4em
) in terms of available LaTeX variables?