# Hidden line numbers

MWE:

\documentclass[12pt]{book}
\usepackage{lineno}
\begin{document}

\chapter{Hidden Line Number}\label{cha:hln}
\linenumbers
%\begin{nolinenumbers}
One

Two\linelabel{two}\label{two}

Three

The sentence about \textbf{two}, page-\pageref{two}, chapter-\ref{cha:hln}, line number-\lineref{two}

%\end{nolinenumbers}
\end{document}

That I want what to do, hide linenumbers. If it possible?

• \nolinenumbers at the right place switches them off , \linenumbers will reenable them
– user31729
Mar 1 '15 at 11:52
• Add to \nolinenumbers -- Package lineno Error: \linelabel without \linenumbers Mar 1 '15 at 11:58
• Of course, you can't use a \linelabel when there is no linenumber ;-)
– user31729
Mar 1 '15 at 11:59
• Never end a paragraph with \\ all the \\ in your document are incorrect (and LaTeX gets very unhappy: Underfull \hbox (badness 10000) in paragraph at lines 8--9 badness 10000 is as bad as it gets Mar 1 '15 at 12:08
• @DavidCarlisle, Ok. Mar 1 '15 at 12:18

\documentclass[12pt]{book}
\usepackage{lineno}
\begin{document}

\chapter{Hidden Line Number}\label{cha:hln}
\linenumbers
%\begin{nolinenumbers}
\let\makeLineNumber\relax
One

Two\linelabel{twol}\label{two}

Three

The sentence about \textbf{two}, page-\pageref{two}, chapter-\ref{cha:hln}, line number-\lineref{twol}

%\end{nolinenumbers}
\end{document}
• Is the viewer of this document expected to count the line number himself then? ;-) (Ok, it's only in line number 2, so this should be possible ;-))
– user31729
Mar 1 '15 at 12:16
• +1, but it's probably safer to save the meaning of \makeLineNumber for later use. Mar 1 '15 at 12:19
• @karlkoeller I assume the real example it's inside a group:-) Mar 1 '15 at 12:20