在以下 MWE 中:
\documentclass[]{book}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{titlesec}
\titleformat{\chapter}%
[display]% shape
{\filcenter}% format applied to label+text
{\bfseries\huge\thechapter}% label
{0pt}% horizontal separation between label and title body
{\huge}% before the title body
[\vspace{0ex}{\includegraphics[scale=0.35]{divider.pdf}}]% after the title body
\titlespacing{\chapter}{0pt}{0ex}{2ex}
\assignpagestyle{\chapter}{empty}
\begin{document}
\chapter{Test Chapter}
This an indented paragraph.
\noindent This is an unindented paragraph.
\end{document}
所包含的图形(我认为)导致第一段缩进。我尝试了\noindent
上述代码中的各种方法,但没有帮助。(此外,我不明白noindent
包如何提供帮助。
\noindent
除了在第一段前手动插入外,还有其他方法可以实现自动化吗?
答案1
下列的标题安全的文档
带星号的版本取消了标题后段落的缩进,但以下情况除外:降低,裹和跑进但这种可能性毫无意义。
所以这就是\titlespacing*
你所需要的。
\documentclass[]{book}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{titlesec}
\titleformat{\chapter}%
[display]% shape
{\filcenter}% format applied to label+text
{\bfseries\huge\thechapter}% label
{0pt}% horizontal separation between label and title body
{\huge}% before the title body
[\vspace{0ex}{\includegraphics[scale=0.15]{example-image}}]% after the title body
\titlespacing*{\chapter}{0pt}{0ex}{2ex}
\assignpagestyle{\chapter}{empty}
\begin{document}
\chapter{Test Chapter}
This an indented paragraph.
\noindent This is an unindented paragraph.
\end{document}