I use lots of highlights as it is used to mark my revision from each version before I gave to my lecturer. When I highlight lots of texts, I found out that sometimes page restarted in the middle.
After an hour of stress, I found the cause, that is heavy use of highlight as mentioned here. That page mention soul
, but I use soulpos
. It seems that both packages got the same bug.
Below is my code to make the highlight:
\usepackage{soulpos}
\ulposdef{\hly}{%
\mbox{%
\color{yellow}%
\rule[-.8ex]{\ulwidth}{11pt}%
\tolerance=1%
\emergencystretch=\maxdimen}}
Any solution? Why this is happening? Can this kind of bug be fixed? Thanks.
EDIT:
From the comment section, this bug for soul is discussed and solved here. Sadly, soulpos
did not use \countdef
and the same fix can't be used.
EDIT after more testing:
Okay, now I become more confused:
- With separate cls, soulpos did not get this problem. See here
- With no separate cls, soulpos can't solve even with the minus. See here
This (No 2) got wrong page numbering, but not if I use .cls (see No 1)
\documentclass{article}
\usepackage{soulpos}
\makeatletter
\newcount\SOUL@minus
% \newcount\SOULPOS@minus
\makeatother
\usepackage{xcolor}
\usepackage{blindtext}
\ulposdef{\hly}{%
\mbox{%
\color{yellow}%
\rule[-.8ex]{\ulwidth}{11pt}%
\tolerance=1%
\emergencystretch=\maxdimen}}
\begin{document}
\Blindtext[4]
\blindtext
\hl{Closing words
New paragraph!}
\clearpage
\Blindtext[4]
\blindtext
\hly{Closing words
New paragraph!}
\end{document}
\usepackage[soul]{lua-ul}
\mbox{% \color{yellow}% \rule[-.8ex]{\ulwidth}{11pt}% \tolerance=1% \emergencystretch=\maxdimen
makes yellow rule but why are you setting\tolerance=
and\emergencystretch
in an\mbox
?????soul
. Is a fix possible forsoulpos
?