不需要的间距

不需要的间距

不需要的间距

marginnote软件包在节标题和段落开头之间引入了一些额外的间距(这是不必要的)。如何纠正这个问题?

例子

在此处输入图片描述在此处输入图片描述

平均能量损失

\documentclass{extarticle}

\usepackage{lipsum}
\usepackage{marginnote}
\usepackage{titlesec}

% Shorten the spacing after section headings
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}

\begin{document}
\subsection{Normal spacing}
\lipsum[1-4]
\subsection{Unwanted spacing}
\marginnote{Something very long and interesting. Something very long and interesting.}
\lipsum[1]
\end{document}

答案1

这段代码用简单的\marginpar似乎可以改善布局:

\documentclass{extarticle}

\usepackage{lipsum}
\usepackage{titlesec}

% Shorten the spacing after section headings
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}

\begin{document}

\subsection{Normal spacing}
\lipsum[1-4]
\subsection{Unwanted spacing}
 \leavevmode\marginpar{\raggedright Something very long and interesting. Something very long and interesting.}
\lipsum[1]

\end{document}

在此处输入图片描述

答案2

添加\hrule使间距更加明显。显然在开头\marginnote添加了 ,而不是简单的。\strut\leavevmode

\documentclass{extarticle}

\usepackage{lipsum}
\usepackage{marginnote}
\usepackage{titlesec}

% Shorten the spacing after section headings
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}

\begin{document}
\subsection{Normal spacing}
\lipsum[1-4]
\subsection{Unwanted spacing}
%\hrule
\smash{\marginnote{Something very long and interesting. Something very long and interesting.}}%
\lipsum[1]
\end{document}

相关内容