setstretch 和 todonotes

setstretch 和 todonotes

我正在尝试使用该todonotes包将边距注释连接到文本中的点。为了给注释留出更多空间,我希望能够增加正文的行距而不增加注释内的间距。我曾经setspace设置过行距,但\setstretch在命令中放置额外的命令\todo根本没有效果。

\documentclass{article}

\usepackage{todonotes}

\usepackage{setspace}

\setstretch{1.7}

\begin{document}

This is a long text that goes onto two lines. \todo{\setstretch{1.0} This is a longish note about the text.} I'm not sure what else to put here because I need form and not content but form has to have content.

\end{document}

上述代码的结果

我该如何在注释中独立设置行距?我是否误解了某些内容setspace,或者我应该使用其他软件包,还是其他什么?

(我已经看到了该问题的解决方案,但它涉及一个似乎没有的fixme参数。)todonotes

答案1

\selectfont之后你失踪了\setstretch{1}

为了避免在每个注释中都输入内容\setstretch{1}\selectfont,你可以滥用该size键:

\documentclass{article}

\usepackage{todonotes}

\usepackage{setspace}

\setstretch{1.7}
\presetkeys{todonotes}{size=\setstretch{1}\selectfont}{}

\begin{document}

This is a long text that goes onto two
lines.\todo{This is a longish note about the text.}
I'm not sure what else to put here because I need
form and not content but form has to have content.

\end{document}

在此处输入图片描述

答案2

为了允许单行间距并使其与我的 biblatex 一起工作,我定义了一个新命令,因为重新定义它有点复杂。

\newcommand{\note}[1]{\todo[]{\linespread{1}\footnotesize #1 \par}}

答案3

另一种出路(改编自朝九晚五的科学


\documentclass{article}

\usepackage[color=blue!10, 
            linecolor=blue!60!gray,
            textsize=footnotesize]
           {todonotes}
\usepackage{setspace}

\setstretch{1.7}

\makeatletter
\renewcommand{\todo}[2][]{%
    \@todo[caption={#2}, #1]{\begin{spacing}{0.85}#2\end{spacing}}%
} 
\makeatother 

\begin{document}

This is a long text that goes onto two lines.
\todo{This is a longish note about the text.}%
I'm not sure what else to put here because I need
form and not content but form has to have content.

\end{document}

添加了一些不同的颜色和换行美感......
产生了以下(大概令人愉悦的)输出:

输出图像

相关内容