如何删除段落末尾和章节之间的空格?

如何删除段落末尾和章节之间的空格?

我正在使用 titlesec 删除章节和文本之间的空格,\titlespacing{\section}{0pt}{0em}{0pt}{}但这在段落结尾和章节之间不起作用,负值会被忽略\titlespacing{\section}{0pt}{-1em}{0pt}{}

\documentclass[12pt, a4paper]{extreport}

\usepackage[margin=2cm, top=2cm, right=1.4cm, bottom=2cm, left=2.8cm]{geometry}

\setlength{\parskip}{0em}

\usepackage{setspace}
\linespread{1.5}

\usepackage{titlesec}

\titlespacing{\chapter}{0pt}{-32pt}{0pt}{}
\titlespacing{\section}{0pt}{0em}{0pt}{}
\titlespacing{\subsection}{0pt}{0pt}{0pt}{}
\titlespacing{\subsubsection}{0pt}{0pt}{0pt}{}

\titleformat{\chapter}[hang]
  {\normalsize\bfseries\center}
  {\thechapter.}
  {0.5em} 
  {\uppercase}

\titleformat{\section}[hang]
  {\normalsize\bfseries\center}
  {\thetitle.}
  {0.5em} 
  {\uppercase} 

\titleformat{\subsection}[hang]
  {\normalsize\bfseries\center}
  {\thetitle.}
  {0.5em}
  {\uppercase} 

\begin{document}

\section{Section 1}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur dapibus quam quis ornare mattis. Fusce nec leo sit amet quam suscipit feugiat at nec nisl. Nullam ullamcorper ipsum quis ante tempus efficitur. Mauris et erat at neque tincidunt vestibulum in quis nulla. Donec venenatis vulputate vulputate.

\section{Section 1}

Aliquam rutrum blandit mauris, et sagittis libero vestibulum id. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed aliquam velit id sem eleifend, in tincidunt felis semper. Quisque non libero vel lectus sagittis consectetur. Aenean vehicula, tortor vitae rutrum porta, arcu urna viverra dui, sed sollicitudin libero nibh eu ligula.

\section{Section 1}

\section{Section 1}

\end{document}

我怎样才能删除段落末尾和章节之间的这个空格?

对不起,我的英语不好。

例子

答案1

使用.\centering代替\center.center是一个列表命令并引入间距。

\documentclass[12pt, a4paper]{extreport}

\usepackage[margin=2cm, top=2cm, right=1.4cm, bottom=2cm, left=2.8cm]{geometry}

\setlength{\parskip}{0em}

\usepackage{setspace}
\linespread{1.5}

\usepackage{titlesec}

\titlespacing{\chapter}{0pt}{-32pt}{0pt}{}
\titlespacing{\section}{0pt}{0em}{0pt}{}
\titlespacing{\subsection}{0pt}{0pt}{0pt}{}
\titlespacing{\subsubsection}{0pt}{0pt}{0pt}{}

\titleformat{\chapter}[hang]
  {\normalsize\bfseries\centering}
  {\thechapter.}
  {0.5em}
  {\uppercase}

\titleformat{\section}[hang]
  {\normalsize\bfseries\centering}
  {\thetitle.}
  {0.5em}
  {\uppercase}

\titleformat{\subsection}[hang]
  {\normalsize\bfseries\centering}
  {\thetitle.}
  {0.5em}
  {\uppercase}

\begin{document}

\section{Section 1}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur dapibus quam quis ornare mattis. Fusce nec leo sit amet quam suscipit feugiat at nec nisl. Nullam ullamcorper ipsum quis ante tempus efficitur. Mauris et erat at neque tincidunt vestibulum in quis nulla. Donec venenatis vulputate vulputate.

\section{Section 1}

Aliquam rutrum blandit mauris, et sagittis libero vestibulum id. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed aliquam velit id sem eleifend, in tincidunt felis semper. Quisque non libero vel lectus sagittis consectetur. Aenean vehicula, tortor vitae rutrum porta, arcu urna viverra dui, sed sollicitudin libero nibh eu ligula.

\section{Section 1}

\section{Section 1}

\end{document}

在此处输入图片描述

相关内容