如何刪除段落結尾和部分之間的空格?

如何刪除段落結尾和部分之間的空格?

我正在使用 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}

在此輸入影像描述

相關內容