I store my LaTeX files in a mercurial repository for backup and to transfer work between home and office. This means that my .tex files live in different paths on different computers, but the information inside a .synctex.gz file uses absolute paths. This means that if I update and compile a file at home, push it, then pull it at my office, inverse search is broken until I recompile the file and regenerate the synctex file. This is particularly annoying because the most useful time to have inverse search is when you've just opened the file you're currently working on and need "random access" to get to the right part - easiest to do in the PDF.

I can't see any way to customise the output of synctex, but is there some hidden trick? I'm using Okular and gvim with the standard inverse search command:

gvim --servername GVIM --remote +%l %f

Which perhaps can be modified to strip the absolute path off, but this seems error prone when the correct file is not in the same directory as the PDF, and in any case I was having trouble customising this command.

I expect I could add a hook in mercurial to munge the synctex file but that also seems a very bad solution. In my view the "correct" solution would be an option to generate relative paths with SyncTeX, but they seem quite adamant that the absolute paths should stay. I don't think we can rely on them to do anything anyway, what with the debacle over the /./ in the middle of the paths.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.