以下最小工作示例演示了 vruler 代码导致 synctex 机制失败。通过渲染此 TeX 文件并尝试单击任意位置,您将看到这一点。它不会将您发送到您单击的位置。有人看到修复方法了吗?
该代码是由我的一些前任拼凑起来的。
\documentclass{article}
\usepackage{eso-pic}
\makeatletter
\newbox\GOOrulerbox
\newcount\GOOrulercount
\newdimen\GOOruleroffset
\newdimen\cv@lineheight
\newdimen\cv@boxheight
\newbox\cv@tmpbox
\newcount\cv@refno
\newcount\cv@tot
% NUMBER with left flushed zeros \fillzeros[<WIDTH>]<NUMBER>
\newcount\cv@tmpc@ \newcount\cv@tmpc
\def\fillzeros[#1]#2{\cv@tmpc@=#2\relax\ifnum\cv@tmpc@<0\cv@tmpc@=-\cv@tmpc@\fi
\cv@tmpc=1 %
\loop\ifnum\cv@tmpc@<10 \else \divide\cv@tmpc@ by 10 \advance\cv@tmpc by 1 \fi
\ifnum\cv@tmpc@=10\relax\cv@tmpc@=11\relax\fi \ifnum\cv@tmpc@>10 \repeat
\ifnum#2<0\advance\cv@tmpc1\relax-\fi
\loop\ifnum\cv@tmpc<#1\relax0\advance\cv@tmpc1\relax\fi \ifnum\cv@tmpc<#1 \repeat
\cv@tmpc@=#2\relax\ifnum\cv@tmpc@<0\cv@tmpc@=-\cv@tmpc@\fi \relax\the\cv@tmpc@}%
% \makevruler[<SCALE>][<INITIAL_COUNT>][<STEP>][<DIGITS>][<HEIGHT>]
\def\makevruler[#1][#2][#3][#4][#5]{
\begingroup\offinterlineskip
\textheight=#5\vbadness=10000\vfuzz=120ex\overfullrule=0pt%
\global\setbox\GOOrulerbox=\vbox to \textheight{%
{
\parskip=0pt\hfuzz=150em\cv@boxheight=\textheight
\cv@lineheight=#1\global\GOOrulercount=#2%
\cv@tot\cv@boxheight\divide\cv@tot\cv@lineheight\advance\cv@tot2%
\cv@refno1\vskip-\cv@lineheight\vskip1ex%
\loop\setbox\cv@tmpbox=\hbox to0cm{ % side margin
\hfil {\hfil\fillzeros[#4]\GOOrulercount}
}%
\ht\cv@tmpbox\cv@lineheight\dp\cv@tmpbox0pt\box\cv@tmpbox\break
\advance\cv@refno1\global\advance\GOOrulercount#3\relax
\ifnum\cv@refno<\cv@tot\repeat
}
}
\endgroup
}%
\makeatother
% ----- end of vruler
% \makevruler[<SCALE>][<INITIAL_COUNT>][<STEP>][<DIGITS>][<HEIGHT>]
\def\GOOruler#1{\makevruler[12pt][#1][1][3][\textheight]\usebox{\GOOrulerbox}}
\AddToShipoutPicture{%
\GOOruleroffset=\textheight
\advance\GOOruleroffset by 5.2pt % top margin
\color[rgb]{.7,.7,.7}
% \ifdefined\isaccepted \else
\AtTextUpperLeft{%
\put(\LenToUnit{-35pt},\LenToUnit{-\GOOruleroffset}){%left ruler
\GOOruler{\GOOrulercount}}
\put(\LenToUnit{1.04\textwidth},\LenToUnit{-\GOOruleroffset}){%right ruler
\GOOruler{\GOOrulercount}}
}
% \fi
}
\begin{document}
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
aoeusthaoeusnh to uhsaoeuahoes aoesuthaoeu sntoeuhsnao uatoesh oeust aocr3g09o7u lroheushaeo [8aoeusaoehaoe
\end{document}