I recently ran into a curious bug when using the soul package. I
managed to boil it down to the following example. The problem is that
the page numbers get messed up. In the example below, they should be
1, 2 and 3. In fact, they are 1, 0 , and 1, in that order. It appears
(in some cases) that adding blank lines inside a \hl environment sometimes
causes this problem, and removing the blank lines fixes the
problem. As one can check, removing the blank line inside the \hl{}
fixes the problem in the example below. It is also possible to fix
the problem in other ways.
Anyway, now that I have discovered this, I can work around the problem
in my paper. However, I'm curious as to what is causing this,
so I thought I might as well post the question. I didn't try asking
the creator ofsoul, which I think is probably unmaintained. The last
update was a long time ago. This is with Debian squeeze, using TeX Live 2009 and soul.sty version 2.4.
I'm using the LaTex function dummytext below to generate dummy data
courtesy of the kind folks on this site, see Generating dummy text
programatically using
TeX/LaTeX
The specific solution I'm using is by Martin
Scharrer.
\documentclass[10pt]{article}
\usepackage{soul}
\usepackage{pgffor}
\usepackage{setspace}
\doublespacing
\newcommand\dummytext[3]{%
\foreach \n in {1,...,#3} {%
\foreach \k in {1,...,#2} {%
#1%
}%
\\
}%
}
\pagestyle{myheadings}
\begin{document}
\dummytext{HelloWorld}{5}{52}
\dummytext{HelloWorld}{5}{17}
\hl{
x
}
\end{document}


lipsumorblindtextpackages would make your example even simpler. – raphink Aug 09 '11 at 06:01lipsumat least didn't offer precise control on the number of lines, and I didn't want to have to guess what the right parameters were. I also didn't see a way to do specify the exact number of lines withblindtextbut I didn't look carefully. If you want to suggest a working example using either of these, you can paste it somewhere, and I'll add it to my question. Thanks. – Faheem Mitha Aug 09 '11 at 07:54