[Tex/LaTex] package lineno not working well. skips line. TexLive 2016

line-numbering

I've looked at questions about numbering each line in Latex document, and using package lineno and tried all the tricks shown in the questions and answers, but nothing is working for me. The package still do not number each line. I want each line numbered, including math and text.

Has something changed recently? I tried

\usepackage[]{lineno}
\linenumbers 

Tried

\usepackage[]{lineno}
\internallinenumbers

Tried

\usepackage[]{lineno}
\linenumbers 
\setrunninglinenumbers
\runninglinenumbers

Tried

\usepackage[]{lineno}
\internallinenumbers
\setrunninglinenumbers
\runninglinenumbers

This last one does the best job, but it stil skips some equations and some text lines as well by random.

Here is a MWE using the above last configuration, as it seems to work best

\documentclass[12pt]{article}%
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}%

\usepackage[]{lineno}
\internallinenumbers
\setrunninglinenumbers
\runninglinenumbers

\begin{document}
\section{problem (a), page 88}%
\[
y^{\prime\prime}=\frac{1}{x^{5}}y
\]
Irregular singular point at $x\rightarrow0^{+}$. 
Let $y=e^{S_{0}\left(x\right)}$ and the above becomes%
\begin{align*}
y\left(  x\right)   &  =e^{S_{0}\left(  x\right)  }\\
y^{\prime}\left(  x\right)   &  =S_{0}^{\prime}e^{S}\\
y^{\prime\prime} &  =S_{0}^{\prime\prime}e^{S_{0}}+\left(  S_{0}^{\prime
}\right)  ^{2}e^{S_{0}}\\
&  =\left(  S_{0}^{\prime\prime}+\left(S_{0}^{\prime}\right) ^{2}\right)e^{S_{0}}
\end{align*}
Substituting back into $\frac{d^{2}}{dx^{2}}y=x^{-5}y$ gives

Hence%
\begin{align*}
S_{1}  & \thicksim-\int\frac{S_{0}^{\prime\prime}}{S_{0}^{\prime}}dx\\
& \thicksim-\ln S_{0}^{\prime}+c
\end{align*}
\end{document}

Here is the pdf generated using lualatex foo.tex You can see it skips lines and some math.

Mathematica graphics

I tried solution given in number-every-line-of-pages/16012#16012 but the code given in the answer there did not even compile for me. Many errors. May be things changed since answer was old.

my question is: How can one number each line (math and text) in document?

Best Answer

This is a response to a comment by the OP in chat.

If all you want is a bunch of numbers down the left margin of the kind which journals add to papers on submission, then this is straightforward. These will not necessarily correspond with actual lines, but they can be used to provide approximate references. Since line numbers are not well-defined for maths anyway, this may be adequate for some purposes.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz,everypage}
\AtBeginDocument{%
  \AddEverypageHook{%
    \begin{tikzpicture}[remember picture,overlay]
      \path (current page.north west) --  (current page.south west) \foreach \i in {1,...,\fakelinenos} { node [pos={(\i-.5)/\fakelinenos}, xshift=\fakelinenoshift, line number style] {\i} }  ;
    \end{tikzpicture}%
  }%
}
\tikzset{%
  line numbers/.store in=\fakelinenos,
  line numbers=50,
  line number shift/.store in=\fakelinenoshift,
  line number shift=5mm,
  line number style/.style={text=gray},
}
\begin{document}
\section{problem (a), page 88}
\[
y^{\prime\prime}=\frac{1}{x^{5}}y
\]
Irregular singular point at $x\rightarrow0^{+}$.
Let $y=e^{S_{0}\left(x\right)}$ and the above becomes%
\begin{align*}
  y\left(  x\right)   &  =e^{S_{0}\left(  x\right)  }\\
  y^{\prime}\left(  x\right)   &  =S_{0}^{\prime}e^{S}\\
  y^{\prime\prime} &  =S_{0}^{\prime\prime}e^{S_{0}}+\left(  S_{0}^{\prime
  }\right)  ^{2}e^{S_{0}}\\
  &  =\left(  S_{0}^{\prime\prime}+\left(S_{0}^{\prime}\right) ^{2}\right)e^{S_{0}}
\end{align*}
Substituting back into $\frac{d^{2}}{dx^{2}}y=x^{-5}y$ gives

Hence
\begin{align*}
  S_{1}  & \thicksim-\int\frac{S_{0}^{\prime\prime}}{S_{0}^{\prime}}dx\\
  & \thicksim-\ln S_{0}^{\prime}+c
\end{align*}
\end{document}

fake line numbers

Related Question