1

I read these two questions: 1 and 2, but I am still in a trouble.

So, I have two files:

test1.tex:

\documentclass[12pt,a4paper]{article}
\usepackage[nopar]{lipsum} 
\usepackage[pagewise]{lineno}
\begin{document}
    \linenumbers  % enable line numbering
    \lipsum[1-6]
    \\ \\
    \label{important}IMPORTANT INFORMATION
    \\ \\
    \lipsum[1-6]
\end{document}

and test2.tex:

\documentclass[12pt,a4paper]{article}
\usepackage[nopar]{lipsum} 
\usepackage{xr}
\externaldocument{test1}
\begin{document}
    Important information was given on line \ref{important} of page~\pageref{important}.
\end{document}

But line number did not appear. Could you help me to have referencing with line number?

2

You can refer with \ref to the number of a line, which has been marked with \linelabel{lne:item}. The command \lineref does something completely different, see the manual.

So you get your reference with:

\documentclass[12pt,a4paper]{article}
\usepackage[nopar]{lipsum} 
\usepackage[pagewise]{lineno}
\begin{document}
    \linenumbers  % enable line numbering
    \lipsum[1-6]

    \linelabel{lne:important}IMPORTANT INFORMATION

    \lipsum[1-6]

    The IMPORTANT INFORMATION ist given in line no. \ref{lne:important} on page
    \pageref{lne:important}

\end{document}

The result ist something like »The IMPORTANT INFORMATION ist given in line no. 12 on page 2« in the PDF.

| improve this answer | |

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.