【问题标题】:How to disable indentation of LaTeX list items? [closed]如何禁用 LaTeX 列表项的缩进? [关闭]
【发布时间】:2010-11-28 11:02:13
【问题描述】:

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

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

【问题讨论】:

    标签: latex margin


    【解决方案1】:

    您最好的选择可能是使用mdwlist packageenumlist package

    或者this website 建议像这样使用list 环境:

    \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}}
    

    这似乎对我有用..

    【讨论】:

      【解决方案2】:

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

      paralist 还提供了inparaenum 环境,该环境专为段落内列表而设计:类似于“到达那里的三种方式:一种可以(1)左转,(2)右转,或( 3)直走。”您可以使用此环境,如果您愿意,可以插入自己的分段符。这给出了一个刷新枚举,但在段落的开头有缩进。如果是这样,也许你应该使用\paragraph

      【讨论】:

        【解决方案3】:

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

        【讨论】:

        • 我对@9​​87654322@ 方法的测试使用了上面展示的newenvironemt,并且确实成功了。恐怕您可以在标题中执行\newlength{\enumindent}\setlength{\enumindent}{1.4em} 以使其成为命名常量。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-12-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多