1

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:

  1. With separate cls, soulpos did not get this problem. See here
  2. 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}
7
  • 2
    sorry but neither your question nor the page you link too contains any useful information. You only claim that soul is doing something without any proof or code. But if you want to do lots of highlighting, I recommend to switch to lualatex and lua-ul. That is much more stable than soul. Commented Feb 17, 2023 at 15:51
  • As @UlrikeFischer said, switch to lua. You can even make lua-ul backwards compatible to soul: \usepackage[soul]{lua-ul}
    – DG'
    Commented Feb 17, 2023 at 15:54
  • Does the answers at tex.stackexchange.com/questions/25250/… helps you?
    – quark67
    Commented Feb 17, 2023 at 16:31
  • 1
    \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 ????? Commented Feb 17, 2023 at 19:50
  • @quark67 thanks a lot, that was the point of my question. Sadly, the fix described there only works for soul. Is a fix possible for soulpos? Commented Feb 18, 2023 at 4:32

1 Answer 1

1

After some trial and error, based on @quark67 comment, I found out that using this combo solve my issue. I haven't fully tested it, but it works for now.

\usepackage{soulpos}
\newcount\SOUL@minus

EDIT after more testing:

Okay, now I become more confused:

  1. With separate cls, soulpos did not get this problem. See here
  2. With no separate cls, soulpos can't solve even with the minus. See here
4
  • do you really need SOULPOS@minus ? I do not see any use of that name in the package. SOUL@minus is for a soul package bug as quark67 commented Commented Feb 18, 2023 at 11:46
  • 2
    we have just adopted soul and pushed a fix for SOUL@minus to ctan Commented Feb 18, 2023 at 23:54
  • @DavidCarlisle After more testing with cleaned artifact, only \newcount\SOUL@minus seems works and \newcount\SOULPOS@minus seems do nothing. Thanks. Commented Feb 19, 2023 at 4:21
  • ok as I expected the updated soul and soulutf8 packages should be in texlive in a day or so Commented Feb 19, 2023 at 8:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .