待办事项注释位于错误的边距中

待办事项注释位于错误的边距中

在撰写另一份文件时,我注意到待办事项注释打印在错误的边距中。起初我以为这是因为 的使用不当\reversemarginpar,但经过一番尝试后,我认为待办事项笔记在溢出页面时很难跟踪它浮动到哪个边距。请参见以下示例:

待办事项注释位于错误的边距中

在此处输入图片描述

TeX 容量超出

我在尝试复制该问题时偶然发现了这一点,并注释掉了该行。如果取消注释:

% If you uncomment this line you get a 'Tex Capacity exceeded'.
%\dummysentences{10} \todo{\dummysentences{1}} \dummysentences{2}

我收到 TeX 容量超出错误,但编译失败。我不知道是什么原因造成的,这也不是我主要关心的问题,但如果有人能解释一下,我还是会很感兴趣,但我不确定这是否相关,或者是否值得单独提出一个问题。

我的不那么简单的工作示例

不幸的是,尝试从我的原始文档中复制这个问题出乎意料地困难,因此我尽可能地减少了它,同时仍然保留了这个问题。具有讽刺意味的是,如果将大部分剩余的内容移除或用lipsum替换,将缓解这个问题(尽管不是在我的原始文档中!)。如果有人可以使用更少的内容复制此问题,请提供建议。

\documentclass[english,a4paper,11pt,twoside,openright]{book}

\usepackage{fancyhdr} % Nice headers.
\usepackage{graphicx} % Include figures.
\usepackage{lipsum} % Useful for adding jargon.
\usepackage{physics} % Nice partial derivatives and BRAKET notation.
\usepackage[textsize=footnotesize]{todonotes} % A nice TODO list. [disable] to supress.
\usepackage{xspace} % Gives nice spacing for commands.
\usepackage[top=20mm,bottom=20mm,left=20mm, right=30mm, heightrounded, marginparwidth=24mm,  marginparsep=3mm, headsep=10mm]{geometry} % Use nice margins. Does give a small change in the default page margins. 

\setlength{\parindent}{15mm} % Nice paragraph indents.

% Removes hyphenation
\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000

\pagestyle{fancy} % The headers and footers.

% Define the dummy sentence, an ancient palindrome.
\def\sator{Sator Arepo tenet opera rotas.\xspace}

% A command to print the sentence repeatedly.
% Argument #1 is the number of times to repeat it.
\newcount\loopcounter
\def\dummysentences#1{%
    \loopcounter = #1
    \loop
    \sator\ %
    \advance\loopcounter by -1
    \ifnum\loopcounter > 0
    \repeat%
}

 
\begin{document}
\clearpage
\noindent
\dummysentences{4}
\begin{align}
a & \approx \sum_{i=0}^{A} \\
& = \sum_{i=0}^{A} 
\end{align}

\dummysentences{20}

\subsection{Some filler text}

\lipsum[1]

\lipsum[1]

\subsubsection{subsec 1}

\subsubsection{subsec 2}

\subsubsection{subsec 3}

\subsection{Ow noo}

\dummysentences{12} \todo{In the correct margin.} \dummysentences{2}

\dummysentences{10} \todo{argh. and I'm in the wrong margin} \dummysentences{2}

% If you uncomment this line you get a 'Tex Capacity exceeded'.
%\dummysentences{10} \todo{\dummysentences{1}} \dummysentences{2}

Some very interesting text.\todo{I'm where I am supposed to be}, \dummysentences{3} 

\end{document}

相关内容