My question is related to Line number in cross reference. I would like to give a reference to the line number of an specific line without any visible line number on the entire document.

The below solution provided by Mico partially does the job but I would like that the line numbers to be totally invisible in the entire document. The suggestion of using \modulolinenumbers[] doesn't help either as my document is very large (more than > 10,000 lines) and \modulolinenumbers[n] does not work for big n's such as n=10,000. Also I am looking for a alternative solution in which the total number of lines is unknown thus avoiding \modulolinenumbers[n].

\linenumbers  % enable line numbering

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque\linelabel{word:pellentesque} habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices.  Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.

\nolinenumbers % disable line numbering
The word \emph{pellentesque} occurs on line \ref{word:pellentesque} of page~\pageref{word:pellentesque}.
  • i can't see how people could find the reference to the line if you don't number them. Do you refer to a page without numbering them? – Maïeul May 28 '15 at 19:52
  • @Maïeul For books it is rare to number the line, but on many occasion, I have seen the books which refer to " .....the line x of the page y ...". – Name May 30 '15 at 13:51

As I have said, I think it is strange idea to refers to line without numbering them.

However, you can add \renewcommand\LineNumber{} in your preamble.

  • In some situations one needs to refer to a line just one time, also in ordinary books and articles, it is not custom to number the lines. Thank you anyway for your simple solution. – Name Jun 6 '15 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.