我使用该marginnote
软件包创建边注。但是,我发现在节标题后或节标题之间直接添加注释时会出现一些不必要的行为。该命令似乎会创建一个空段落,这是不受欢迎的,因为它会导致多余的空格或缩进。
梅威瑟:
\documentclass{article}
\usepackage{marginnote}
\begin{document}
\section{Testsection}
\marginnote{Oops! Some extra whitespace.}
\subsection{Testsubsection}
But at least no indentation.
\section{Testsection2}
\subsection{Testsubsection2}
\marginnote{hi there!}Some extra indentation
\section{Testsection3}
\subsection{Testsubsection3}
Nothing \marginnote{Move along.} to see here.
\section{Testsection4}
\subsection{Testsubsection4}
\leavevmode\marginnote{Move along.}This also works.
\end{document}
创建
我读过了\marginnote 导致段落缩进,所以我知道\leavevmode
解决方案。但是,这并不能解决第一种情况(在节标题之间添加额外的空格)。
有没有办法定义一个命令,使其始终不会marginnote
创建多余的段落,这样我就可以在我想要的地方使用它而不用考虑它?
答案1
看起来 marginnote 确实想在段落中间使用,但是这是可行的:
\documentclass{article}
\usepackage{marginnote}
\begin{document}
\section[Testsection]{Testsection\marginnote{\normalsize\normalfont
Oops! Some extra whitespace.}}
\subsection{Testsubsection}
But at least no indentation.
\section{Testsection2}
\subsection{Testsubsection2}
%a marginpar bug \marginnote{hi there!}Some extra indentation
Some\marginnote{hi there!} extra indentation
\section{Testsection3}
\subsection{Testsubsection3}
Nothing \marginnote{Move along.} to see here.
\section{Testsection4}
\subsection{Testsubsection4}
\leavevmode\marginnote{Move along.}This also works.
\end{document}