【问题标题】:How to disable indentation in particular section in LaTeX?如何在 LaTeX 的特定部分禁用缩进?
【发布时间】:2015-07-03 22:12:29
【问题描述】:

我只需要在文档的一个部分(具体来说就是小节)中禁用缩进。我该怎么做?

默认缩进由 indentfirst 包提供。

【问题讨论】:

    标签: latex indentation


    【解决方案1】:

    这取决于您想要消除压痕的普遍程度。但我要尝试的第一件事是将\parindent 设置为0pt

    Some text with normal indentation...
    
    {\parindent0pt % disables indentation for all the text between { and }
    
    Text with no indentation.
    
    Still no indentation.
    
    }% restore indentation
    
    Indented again.
    

    【讨论】:

    • 我认为在 LaTeX 中你真的应该使用 \setlength{\parindent}{0pt} 代替。 \parindent0pt 是纯 TeX,它的使用可能会混淆 LaTeX。
    • @Nikratio:它不会混淆 LaTeX,但您可以按照您的说法使用 \setlength。
    • @David \noindent 仅适用于第一段。以下段落将有它们通常的缩进。
    • 我只是想避免缩进我的 \subsubsection。如果我尝试{\parindent0pt \subsubsection{Title}},部分标题就会消失。
    【解决方案2】:

    设置缩进的环境可能是一种可能的解决方案?你在序言中定义它:

    \newlength\mystoreparindent
    \newenvironment{myparindent}[1]{%
    \setlength{\mystoreparindent}{\the\parindent}
    \setlength{\parindent}{#1}
    }{%
    \setlength{\parindent}{\mystoreparindent}
    }
    

    然后你会在你的文档中写如下内容:

    \begin{myparindent}{0pt}
    This paragraph is not indented, ehm well, actually it is indented by 0pt
    which is the same as not indented.
    
    And this paragraph neither\ldots
    \end{myparindent}
    

    或者如果你想要一个大的段落缩进

    \begin{myparindent}{5cm}
    The first line of this paragraph is indented by 5 cm.
    
    And so is the first line of the next paragraph.
    \end{myparindent}
    

    【讨论】:

    • 为什么您认为自 2010 年以来已接受答案的问题需要另一个答案?
    • @Michał:如果你想使用环境,这很有用。
    【解决方案3】:

    \noindent 我认为这就是你想要的。

    【讨论】:

    • \noindent 只在一个段落中禁用缩进。
    猜你喜欢
    • 2010-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-12
    • 1970-01-01
    • 1970-01-01
    • 2021-03-15
    • 2017-02-04
    相关资源
    最近更新 更多