如何禁用LaTeX列表项的缩进? [英] How to disable indentation of LaTeX list items?

查看:890
本文介绍了如何禁用LaTeX列表项的缩进?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,枚举"环境相对于当前环境缩进.如何禁用此缩进,以便三个项目的枚举环境将产生与以下代码相同的输出?

By default the "enumerate" environment is indented with respect to the current environment. How can I disable this indentation so that an enumerate environment of three items would produce the same output as the following piece of code?

\documentclass{article}
\begin{document}
  \paragraph{1.}
  \paragraph{2.}
  \paragraph{3.}
\end{document}

推荐答案

我将三种建议的方法编译到一个文件中,以便可以并排比较它们.请注意,\ setlength {\ leftmargin} {0pt}对枚举"环境没有任何影响.到目前为止,最好的解决方案是使用选项"\ leftmargin = 1.4em"的列表"环境.但是,我不喜欢代码中的常数,因为它会使代码易碎.有人知道如何根据可用的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 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}

这篇关于如何禁用LaTeX列表项的缩进?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆