Titlesec 空间问题

Titlesec 空间问题
\documentclass[11pt,]{article}
\usepackage{titlesec}
\titleformat{\section}[leftmargin]{\normalfont
\titlerule*[.6em]{\bfseries.}%
\vspace{6pt}%
\sffamily\bfseries\filleft}
{\thesection}{.5em}{}
\titlespacing{\section}
{8pc}{1.5ex plus .1ex minus .2ex}{1pc}
\begin{document}

\section{This is a section heading}
\begin{enumerate}
\item This is the first item and it is too low on the page...
\item This is another item
\item This is another item
\item This is another item
\item This is another item
\item This is another item
\item This is another item
\end{enumerate}
\section{This is a section heading}

This paragraph is fine ...
\end{document}

为什么在列表前有额外的垂直空间,但在段落前却没有?

答案1

\section{…}只需在您的列表之间添加此代码即可无需添加空行

...
\section{This is a section heading}
\leavevmode\vspace*{-\dimexpr\baselineskip+\topsep\relax}
\begin{enumerate}
...

在此处输入图片描述

相关内容