Por si alguien lee un mensaje tan antiguo, TeX no sabe dónde estarán los saltos de página cuando esté organizando el texto en un párrafo, por lo que, a menos que se refiera a líneas dentro del párrafo, no, no hay una forma fácil de obtener números de línea.
Si sabe que su párrafo cruza un límite de página, entonces la forma potencial de obtener números de línea implicaría colocar el tipo correcto de \write de marcado de posición en la página en el lugar correcto, lo que escribe en el archivo .parlocs. Al final del trabajo, encontrar la diferencia entre eso y el inicio anterior de la página/columna y dividir ese número por el tamaño de la línea base.
Sin embargo, la matemática se complica con cualquier cosa como un encabezado de sección, una figura o un cambio en el espaciado de líneas, y por supuesto se basa en la ejecución anterior, por lo que el resultado podría ser incorrecto.
Esto es básicamente una versión más complicada de cómo se calculan los recortes de compensación para las figuras (solo necesitan preocuparse por la cuenta dentro del párrafo) y el resultado allí es … normalmente correcto pero no siempre.
Con respecto a los enlaces, no sé si lo anterior o la documentación está claro: los atributos no necesitan estar unidos a \w o a cualquier otro estilo de carácter en particular, ptxt2pdf crea enlaces basados en el nombre del atributo, no en el marcador al que está unido el atributo.
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.
Traducción automática desde English