如何禁用 LaTeX 列表项的缩进?

发布于 2024-08-04 17:32:46 字数 1459 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

月竹挽风 2024-08-11 17:32:46

您最好的选择可能是使用 mdwlistenumlist

或者此网站建议使用列表 环境如下:

\begin{list}{\labelitemi}{\leftmargin=1em}
\item First item in the list
\item Second item
\item and so on
\end{list}

这表明您可以根据需要重新定义枚举中的长度 leftmargin 。比如:

\newenvironment{flushenum}{
\begin{enumerate}
  \setlength{\leftmargin}{0pt}
}{\end{enumerate}}

这似乎对我有用..

Your best bet is probably to use either the mdwlist package or the enumlist package.

Or this website suggests the use of the list environment like this:

\begin{list}{\labelitemi}{\leftmargin=1em}
\item First item in the list
\item Second item
\item and so on
\end{list}

which suggests that you could redefine the length leftmargin in your enumeration if you prefer. Something like:

\newenvironment{flushenum}{
\begin{enumerate}
  \setlength{\leftmargin}{0pt}
}{\end{enumerate}}

which seems to work for me..

如果没有 2024-08-11 17:32:46

这个问题似乎已经死了,但如果有人像我一样徘徊在这个问题上,还有 paralist package 提供了 asparaitemasparaenum 环境,正是这样做的。

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 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.

最舍不得你 2024-08-11 17:32:46

我将三种建议的方法编译到一个文件中,以便能够并排比较它们。请注意,\setlength{\leftmargin}{0pt}enumerate 环境没有任何影响。到目前为止,最好的解决方案是使用选项 \leftmargin=1.4emlist 环境。但是,我不喜欢代码中的常量,因为它会使代码变得脆弱。有谁知道如何根据可用的 LaTeX 变量计算这个常数 (1.4em)?

\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}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文