![有人将 marginfix 和 tikzmark 结合起来了吗?](https://linux22.com/image/277161/%E6%9C%89%E4%BA%BA%E5%B0%86%20marginfix%20%E5%92%8C%20tikzmark%20%E7%BB%93%E5%90%88%E8%B5%B7%E6%9D%A5%E4%BA%86%E5%90%97%EF%BC%9F.png)
我正在做一个大型图书项目,直到今天我才开始使用胶水。但现在我不得不用了,结果,突然间我的边注的位置就乱了 :( 原因是marginfix
胶水不起作用,因为它在计算胶水之前就定位了注释(至少在我看来是这样)。作者marginfix
承诺将来某个时候会使用 pdfsavepos,但不幸的是我现在需要它。
我现在已经查看了许多其他问题和包,但我找不到合适的替代品marginfix
- 或者我错过了什么?不过,我确实找到了tikzmark
,这很酷。但我没有找到一个包,用于tikzmark
将简单、普通的边注精确地放置在标注行旁边,如果边注太多,可以很好地重新排列它们。
在我编写自己的代码或尝试理解 marginfix 之前,我想知道是否已经有一些可用的解决方案?
更新:
我一直在尝试使用\pdfsavepos
David 的示例...我确实得到了数据,但我真的不明白这些值。如果它们是sp
,参考点是什么,坐标系是什么?即使我通过除以 65536 将它们转换为 pt,这些值也与计算值完全不同marginfix
。
我\MFX@getypos
用这个替换了 marginfix :
\newcounter{mfixcnt}
\def\MFX@getypos{%
\refstepcounter{mfixcnt}%
\pdfsavepos
\edef\tmp{%
\write\noexpand\@auxout{%
\string\mfixdata{\the\c@mfixcnt}{\noexpand\thepage}{\noexpand\the\noexpand\pdflastypos}}%
}\tmp
\expandafter\ifx\csname mfixins@\the\c@mfixcnt\endcsname\relax
\dimen@\dimexpr\@pageht+\@pagedp+\marginposadjustment+\Mfx@mparshift\relax
\typeout{NOT YET: \the\c@mfixcnt -- \the\dimen@ -- \the\@pageht -- \the\@pagedp -- \the\Mfx@mparshift}
\else
\dimen@\dimexpr\csname mfixins@\the\c@mfixcnt\endcsname+\marginposadjustment+\Mfx@mparshift\relax
\fi
\ifnum\outputpenalty=-10002\relax
\advance\dimen@-\Mfx@strutheight
\fi
\edef\mfx@ypos{\the\dimen@}%
\global\Mfx@mparshift\z@
}
\def\mfixdata#1#2#3{%
\typeout{XXXXXXXX mpardata called: #1 -- #2 -- #3}%
\expandafter\gdef\csname mfixins@#1\endcsname{#3sp}%
}
输出为
XXXXXXXX mpardata called: 1 -- 1 -- 42094230
XXXXXXXX mpardata called: 2 -- 1 -- 29740694
XXXXXXXX mpardata called: 3 -- 1 -- 11685526
为什么页边注的值会减小,而这些注解(应该)位于页面下方?只有当 PDF 坐标的原点位于页面底部时,才会出现这种情况。是这样吗?
妇女权利委员会:
\documentclass[12pt]{scrartcl}
\usepackage{geometry}
\geometry{left=2.5cm,textwidth=130mm}
\setlength{\marginparwidth}{4cm}
\setlength{\marginparsep}{2em}
\usepackage{marginfix}
\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum
gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulpu-
tate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi
tristique senectus et netus et malesuada fames ac turpis egestas. Mauris
ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibu- lum urna
fringilla ultrices.XX\marginpar{\textbf{This note is centered because
there is enough space below and it is in the middle of a paragraph.}} Erat
ligula aliquet magna, vitae ornare odio metus a mi. Morbi ac orci et nisl
hendrerit mollis.
Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Nam arcu
libero, nonummy eget, consectetuer id, vulpu- tate a, magna. Donec
vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et
netus et malesuada fames ac turpis egestas.
Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis
vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan bibendum,
erat ligula aliquet magna, vitae ornare odio metus a mi. Morbi ac orci et
nisl hendrerit mollis.Suspendisse ut massa. Cras nec ante. Pellen- tesque
a nulla. Cum sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullam- corper
vestibulum turpis. Pellentesque cursus luctus
mauris.XX\marginpar{\textbf{This note is pushed upwards because it is at
the end of a pragraph}}
Nulla malesuada porttitor diam. Donec felis erat, congue non, volutpat at,
tincidunt tristique, libero. Vivamus viverra fermentum felis. Donec
nonummy pellentesque ante. Phasellus adipiscing semper elit. Proin
fermentum massa ac quam. Sed diam turpis, molestie vitae, placerat a,
molestie nec, leo. Maecenas lacinia. Nam ipsum ligula, eleifend at,
accumsan nec, suscipit a, ipsum. Morbi blandit ligula feugiat magna. Nunc
eleifend consequat lorem. Sed lacinia nulla vitae enim. Pellentesque
tincidunt purus vel magna. Integer non enim. Praesent euismod nunc eu
purus. Donec bibendum quam in tellus. Nullam cursus pulvinar lectus. Donec
et mi. Nam vulputate metus eu enim. Vestibulum pellentesque felis eu
massa.
Quisque ullamcorper placerat ipsum. Cras nibh. Morbi vel justo vi- tae
lacus tincidunt ultrices. Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. In hac habitasse platea dictumst. Integer tempus con-
vallis augue. Etiam facilisis. Nunc elementum fermentum wisi. Aenean
placerat. Ut imperdiet, enim sed gravida sollicitudin, felis odio placerat
quam, ac pulvinar elit purus eget enim. Nunc vitae tortor. Proin tempus
nibh sit amet nisl. Vivamus quis tortor vitae risus porta
vehicula.XX\marginpar{\textbf{This note is automatically adjusted by
`marginfix'.}} Phasellus adipiscing semper elit. Proin fermentum massa ac
quam. Sed diam turpis, molestie vitae, placerat a, molestie nec, leo.
Maecenas lacinia. Nam ipsum ligula, eleifend at, accumsan nec, suscipit a,
ipsum. make ot just a bit longer to show it moving better.
bibendum,
nulla a vel justo vi- tae lacus tinci dunt ultrices. Lorem ipsum dolor sit
amet. Maecenas lacinia. Nam ipsum ligula, eleifend at, accumsan nec,
suscipit a, ipsum. Morbi blandit ligula feugiat magna. Nunc eleifend
consequat lorem. Sed lacinia nulla vitae enim. Pellentesque tincidunt
purus vel magna. Integer non enim. Praesent euismod nunc eu purus. Donec
bibendum quam in tellus. Nullam cursus pulvinar lectus. Donec et mi. Nam
vulputate metus eu enim. Vestibulum pellentesque felis eu massa.
\end{document}