%%
%% The LaTeX Companion, 3ed
%%
%% Example 4-3-5 on page I-337 in "lineno --- Numbering lines of text".
%%
%% Copyright (C) 2022 Frank Mittelbach
%%
%% It may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%%
%% See https://www.latex-project.org/lppl.txt for details.
%%

\documentclass{tlc3exa}
\pagestyle{empty}
\setcounter{page}{6}
\setlength\textwidth{231.0pt}

\addtolength\textwidth{-30pt}
\newcommand\sample{ Some text to experiment
                 with line numbering.}
%StartShownPreambleCommands
\usepackage{lipsum,lineno}
\linenumbers
%StopShownPreambleCommands

\begin{document}
\lipsum[1][1-2] (A)\linelabel{first}
\lipsum[1][3-4] (B)\linelabel{second}
\lipsum[1][5-6] \par
\nolinenumbers
In the text we have labels on
lines~\ref{first} and~\ref{second},
but not on line~\lineref[+3]{second}.
\end{document}
