# lineno skips some lines containing equation environments

I am using TeXworks 0.5 r.1350 (Debian). My tex source is

\documentclass[a4paper,11pt]{article}

\usepackage{amsmath} % needed to get the command equation* to work
\usepackage[a4paper]{geometry} % needed to get the A4 paper size to work
\usepackage{syntonly} % skips producing output and speeds up error check
\usepackage{gensymb} % to use the degree symbol
\usepackage[displaymath, mathlines]{lineno} %<<<<<<<<<<<<<<<<<<<<
\usepackage{color,soul} % highlighting

\setlength{\voffset}{-3.0cm}
\setlength{\hoffset}{0cm}
\setlength{\textwidth}{13.5cm}
\setlength{\textheight}{28cm}

\pagestyle{empty}
\linenumbers %<<<<<<<<<<<<<<<<<<<<

\begin{document}

\input{myDirectory/myFile.tex}

\end{document}


As I typeset this, the line numbering behaves irregularly in the sense that

• if a paragraph contains no equation environment, it does always well;
• if equation environments are present in the paragraph, it skips numbering more often than not. Edit: Rather, only the starred equations are being skipped over.

Repeating the typesetting and invoking the package without options, that is \usepackage{lineno}, do not help. I am aware of another post where a section break was the issue but I don't think this applies there.

Is there a fix or workaround for this? Thanks for helping me out.

• I'd remove syntonly, to begin with. However, without seeing an example of code that produces the irregular skipping of numbers it's difficult to say more. – egreg Jan 12 '16 at 21:15
• – Werner Jan 12 '16 at 23:34

Wrapping the starred equations in a linenomath environment sorted out the issue.

Expediency tip: substitute

\begin{equation*} with

\begin{linenomath}\begin{equation*},

and

\end{equation*} with

\end{equation*}\end{linenomath}.

The user manual clarifies that the option displaymath works on the equation environment but not on equation* -- see Sec. 7.1. (I had missed this piece of evidence in my diagnosis.)

At first run the numbering restarted in the middle of the page some times. Typesetting once again sorted this out.

One other oddity is that the numbering mode switches to page-wise instead of staying with the default 'running' (continuous mode).

Forcing the running mode by setting \usepackage[displaymath, mathlines,running]{lineno} is insufficient. I also needed to delete the aux files and typeset to move on. The page-wise mode returns at the next typeset command. The outcome in the page-wise mode is neat though.

In closing, the manual informs me that since lineno version 4.3 onwards this wrapping has been implemented automatically (page 43). I use version 4.41. Hence equation* appears to have been left out of cover.

Happy to be corrected. Thanks to @Werner for pointing me towards a resource I missed.