I have a document in which the displayed page number goes from 8 on the 8th page to 0 on the next page. Unfortunately I cannot provide the code because the document is confidential and when I replace the code by \lipsums to de-confidentialise it the resetting ceases.
I tried debugging the problem with lots of \thepage commands to see where the page number changed inappropriately. It appears to do that after a section of highlighted text in the environment \hl{...} from package soul.
At first it appeared that this only happened when the environment spanned the soft page break. But later I found it happening even in a case where the \hl environment was near but did not span the soft page break.
Is anybody aware of known problems of interactions between soul's \hl environment and the page counter, and how to circumvent them? Or if not, of interactions with other packages that can cause unwanted page counter resets. I have searched the code and it definitely contains no explicit counter commands such as \setcounter or \newcounter in the code.
Thank you
Although I cannot provide the document code, I can provide the preamble that shows what packages I am using:
\documentclass[11pt,a4paper]{article}
\usepackage[margin=0.75in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
%\usepackage{breqn}
\usepackage{xypic} % for commutative diagrams
\usepackage{color}
\usepackage[hidelinks]{hyperref}
\usepackage{soul}
\usepackage{graphicx}
\usepackage{epstopdf}
%\usepackage[square,sort,comma,numbers]{natbib}
\usepackage[authoryear]{natbib}
\usepackage[usenames,dvipsnames]{xcolor}
\newcommand{\hlc}[2]{ {\sethlcolor{#1} \hl{#2}} }
\newcommand{\hilight}[1]{\colorbox{yellow}{#1}}
\usepackage[mathscr]{euscript}
\usepackage{booktabs} % For \toprule, \midrule and \bottomrule
%\usepackage{siunitx} % Formats the units and values
%\usepackage{pgfplotstable} % Generates table from .csv
%\usepackage{relsize} % allows use of \mathlarger{} command
\setlength{\parindent}{0pt} % this stops indentation 1st line of para
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex} % this adds space after each para
\newcommand{\Z}{\mathbb{Z}} % defines \Z as shorthand for command \mathbb{Z}
\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{•}b{N}}
\newcommand{\half}{\tfrac{1}{2}}
\newcommand{\dbar}[1]{\Bar{\Bar{#1}}}
\newcommand{\kk}{{}_k}
\newcommand\dt {^{\delta t}}
\newcommand{\avg}{\textrm{Avg}\dt}
\newcommand{\prop}{\textrm{Prop}\dt}
\newcommand{\ldt}{\lim_{\delta t\to 0}}
\newcommand{\kinf}{_{k=0}^\infty}
\newcommand{\cadlag}{c\`adl\`ag}
\pagenumbering{arabic}
\newcommand{\rplus}{\R_+}
\newcommand{\highlight}[1]{%
\colorbox{red!50}{$\displaystyle#1$}}
\usepackage{scalerel,stackengine}
\stackMath
\newcommand\reallywidehat[1]{%
\savestack{\tmpbox}{\stretchto{%
\scaleto{%
\scalerel*[\widthof{\ensuremath{#1}}]{\kern-.6pt\bigwedge\kern-.6pt}%
{\rule[-\textheight/2]{1ex}{\textheight}}%WIDTH-LIMITED BIG WEDGE
}{\textheight}%
}{0.5ex}}%
\stackon[1pt]{#1}{\tmpbox}%
}
\begin{document}
\mainmatteror\pagenumberingor\setcounteror just\count0=0it should be easy to make an example from the text you have, just change every letter toxand then check the problem still occurs, and adjust o be more like your original if necessary to trigger the problem. Otherwise there isn't really any answer to the question as posted. – David Carlisle Jun 23 '18 at 00:15x\\x\\x\\x\\xand do that for each para checking the problem still occurs. It will take you less time than it takes to debug an automatic edit. – David Carlisle Jun 23 '18 at 08:18