Caso alguém leia um post tão antigo, o TeX não tem ideia de onde as quebras de página ocorrerão quando estiver organizando o texto em um parágrafo, então, a menos que você esteja falando de linhas dentro do parágrafo, não, não há uma maneira fácil de obter números de linha.
Se você sabe que seu parágrafo está cruzando um limite de página, então a maneira potencial de obter números de linha envolveria inserir o tipo certo de \write de marcação de posição na página no lugar certo, o que grava no arquivo .parlocs. No final do trabalho, encontre a diferença entre isso e o início anterior da página/coluna e divida esse número pelo tamanho da linha base.
A matemática, no entanto, se complica com qualquer coisa como um cabeçalho de seção, figura ou mudança no espaçamento entre linhas, e, claro, é baseada na execução anterior, então o resultado pode estar errado.
Isso é basicamente uma versão mais complicada de como os recortes de deslocamento para figuras são calculados (eles só precisam se preocupar com a contagem dentro do parágrafo) e o resultado lá é … normalmente correto, mas nem sempre.
Quanto aos links, não sei se o acima ou a documentação está claro: os atributos não precisam estar anexados a \w ou a qualquer outro estilo de caractere específico; o ptxt2pdf cria links com base no nome do atributo, não no marcador ao qual o atributo está anexado.
In case anyone reads such an old post, TeX has no idea where page breaks will be when it is arranging text into a paragraph, so unless you’re talking about lines into the paragraph, no, there’s no easy way to get line numbers.
If you know that your paragraph is crossing a page boundary, then the potential way to get line numbers would involve dropping the right sort of position-marking \write onto the page in the right place, which writes to the .parlocs file. At the end of the job, find the difference between that and the previous start of the page/column and dividing that number by the size of the baseline.
The maths, however, gets complicated by anything like a section-header, figure or change in line spacing, and of course it is based on the previous run, so the result might be wrong.
This is basically a more complicated version of how the offset cutouts for figures get calculated, (they only need to worry about the count into the paragraph) and the result there is … normally correct but not always.
Regarding the links, I don’t know if the above or the documentation is clear: the attributes don’t need to be attached to \w or any other particular character style, ptxt2pdf makes links based on the name of the attribute, not the marker the attribute is attached to.
Tradução automática de English