待办事项说明:垂直位置

待办事项说明:垂直位置

在下面的 MWE 中,有没有办法调整侧注的垂直位置?例如,我想将其向上移动,使其与第一段并排。

\documentclass{article}
    
\usepackage[
    showframe,%
    paperwidth=45pc,%
    paperheight=45pc,%
    margin=5pc,%
    bottom=7pc,
    right=15pc,
    %   top=7pc,
    marginparwidth=10pc,%
    %outer=14pc%
    ]{geometry}

\usepackage{libertine}
\usepackage{todonotes}
  
\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing 
elit, sed do eiusmod tempor incididunt ut labore et 
dolore magna aliqua. Id cursus metus aliquam eleifend mi 
in. Feugiat pretium nibh ipsum consequat nisl vel pretium 
lectus. Egestas pretium aenean pharetra magna ac placerat 
vestibulum lectus.

\todo{I want this to move up where the paragraph begins.}
    
Integer malesuada nunc vel risus commodo. Lobortis 
elementum nibh tellus molestie nunc non blandit. Et 
molestie ac feugiat sed. Scelerisque mauris pellentesque 
pulvinar pellentesque habitant morbi tristique. Sed 
vulputate odio ut enim blandit volutpat maecenas volutpat 
blandit. Cras fermentum odio eu feugiat pretium nibh 
ipsum. Neque viverra justo nec ultrices dui sapien eget mi. 

\end{document}

在此处输入图片描述

答案1

您可以重新定义tikzstyle用于todonotes注释的 以添加yshift参数。在注释之前设置此参数,然后确定垂直位置。

梅威瑟:

\documentclass{article}
    
\usepackage[
    showframe,%
    paperwidth=45pc,%
    paperheight=45pc,%
    margin=5pc,%
    bottom=7pc,
    right=15pc,
    %   top=7pc,
    marginparwidth=10pc,%
    %outer=14pc%
    ]{geometry}

\usepackage{libertine}
\usepackage{todonotes}

% style definition copied from todonotes manual
\makeatletter
\tikzstyle{notestyleraw} = [
draw=\@todonotes@currentbordercolor,
fill=\@todonotes@currentbackgroundcolor,
text=\@todonotes@currenttextcolor,
line width=0.5pt,
text width = \@todonotes@textwidth - 1.6 ex - 1pt,
inner sep = 0.8 ex,
rounded corners=4pt,
yshift=\myshift]% added this line
\makeatother

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing 
elit, sed do eiusmod tempor incididunt ut labore et 
dolore magna aliqua. Id cursus metus aliquam eleifend mi 
in. Feugiat pretium nibh ipsum consequat nisl vel pretium 
lectus. Egestas pretium aenean pharetra magna ac placerat 
vestibulum lectus.\def\myshift{15mm}\todo{I want this to move up where the paragraph begins.}
    
Integer malesuada nunc vel risus commodo. Lobortis 
elementum nibh tellus molestie nunc non blandit. Et 
molestie ac feugiat sed. Scelerisque mauris pellentesque 
pulvinar pellentesque habitant morbi tristique.\def\myshift{0mm}\todo{no shift for this one} Sed 
vulputate odio ut enim blandit volutpat maecenas volutpat 
blandit. Cras fermentum odio eu feugiat pretium nibh 
ipsum. Neque viverra justo nec ultrices dui sapien eget mi. 

\end{document}

结果:

在此处输入图片描述

相关内容