Question
Is there any way I can alter the line-numbers reported by TeX and friends in error messages?
This is almost an identical question to Add offset to line number (in error message) when using input files, but the solution there (that LaTeX already treats \input properly) is not helpful for my problem.
I am programmatically generating (using a custom python version of Sweave) .tex files from a different .Plw source file that inserts generated figures, source code etc. As a result, when LaTeX complains, it refers to lines numbers in the generated .tex file rather then the .Plw file that I am editing. Is there anyway I can insert something into the generated .tex file to instruct TeX that the line x in .tex is actually line y in the .Plw file?
The specific problem is simply a matter of offsets: each time a figure, or source code listing is inserted into the file, the current offset changes – it can go up or down – but all the other lines are copied verbatim with the same wrapping etc. as in the original .Plw file.