jlaurens / synctex

Synchronization for TeX
MIT License
57 stars 19 forks source link

[Request] SyncTeX feature for XML first Workflow #68

Open pskumaresh06 opened 5 months ago

pskumaresh06 commented 5 months ago

Hi,

I want to use SyncTeX for my XML first workflow and I have mentioned my process in below:

My process (sample attached in the below): Input XML --> XML to TeX (using XSLT) --> TeX to PDF using LaTeX compiler (Removing TeX file once PDF created) --> PDF preview

Attached sample: XMLfirst.zip

When I use a TeX file as my main input, synchronization between the TeX and PDF files works well. However, I’m considering switching my main input to an XML file and I’m curious if it’s possible to achieve synchronization between the XML and PDF files.

jlaurens commented 5 months ago

This is in theory possible (see R+synctex examples) it depends on how you can control your XSLT process. If you can arrange things such that line n of foo.xml generates line n of foo.tex, with the very same line number, then you just have to post process the .synctex file by changing the appropriate occurrence of 'foo.tex' into 'foo.xml'. If you do not have a one to one mapping, you can always patch the .synctex file like above but synchronization will not be as accurate. It is important that the whole Input: section of the `.synctex file keeps the same length.