You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在LaTeX中禁用段落自动首行缩进功能?

LaTeX 首行自动缩进问题解决方案

问题根因

你遇到的缩进差异是LaTeX的默认排版规则导致的:

  • LaTeX默认会给每个新段落的首行添加固定长度的首行缩进
  • 章节标题(包括你使用的\section*{})后的第一个段落默认不触发首行缩进
  • 你代码里使用的\\只是强制换行,不会开启新段落,所以\\后的More text和前面的A text属于同一段,不会重复添加缩进
  • \newpage命令触发后,新页面的A text属于全新段落,所以会自动加上首行缩进

方案1:全局取消所有段落的首行缩进(最适配你的需求)

直接在导言区添加设置,把全局首行缩进长度设为0即可,所有段落都不会再出现首行缩进,不需要修改正文内容。
修改后的完整代码如下:

\documentclass{article}
\usepackage{graphicx}
% 全局取消首行缩进
\setlength{\parindent}{0pt}

\begin{document}
    \section*{some title}
    A text... \\
    More text... \\
    \includegraphics{example.png}
    \newpage
    A text... \\
    More text... \\
    \includegraphics{example.png}
    \newpage
    A text... \\
    More text... \\
    \includegraphics{example.png}
    \newpage
    \section*{some title}
    A text... \\
    More text... \\
    \includegraphics{example.png}
\end{document}

方案2:仅取消指定段落的首行缩进

如果不需要全局修改,只想单独关闭个别段落的缩进,只需要在对应段落的开头添加\noindent命令即可,示例如下:

\newpage
\noindent A text... \\
More text... \\
\includegraphics{example.png}

内容的提问来源于stack exchange,提问作者Maxxx

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.25 06:15:09