jlaurens / synctex

Synchronization for TeX
MIT License
64 stars 19 forks source link

undesired behavior of copied files #43

Open mohnjahoney opened 3 years ago

mohnjahoney commented 3 years ago

I am writing many job application cover letters (in tex). When I want to write a new letter, I copy the directory and rename AwesomeJobB to AwesomeJobC. I would then open the Cover Letter.tex in AwesomeJobC, find something to change, e.g. the person I am addressing., synctex to jump to the .tex file, and edit.

In part because I often had several tex files open at once, this took me an embarrassingly long time to figure out. Instead of jumping to the tex file in the newly created directory, it would jump to the .tex file from AwesomeJobB (where it was copied). Then I would end up editing the wrong tex file without realizing it until later...

Copying the directory is natural because I want to copy various associated images and stuff.

I don't know if this rises to the level of an "issue" but the idea of syncing to unintended source files might be worth considering. Is there any reason that a synctex file should even look outside its own directory?

Thanks, John

Johns-MBP-3:Cover Letter mycomputer$ tree . ├── AwesomeJobA │   ├── Cover\ Letter.aux │   ├── Cover\ Letter.log │   ├── Cover\ Letter.out │   ├── Cover\ Letter.pdf │   ├── Cover\ Letter.synctex.gz │   └── Cover\ Letter.tex │   └── img1.png │   └── img2.png ├── AwesomeJobB │   ├── Cover\ Letter.aux │   ├── Cover\ Letter.log │   ├── Cover\ Letter.out │   ├── Cover\ Letter.pdf │   ├── Cover\ Letter.synctex.gz │   ├── Cover\ Letter.tex │   └── img1.png │   └── img2.png ...

jlaurens commented 3 years ago

This is a long standing problem.

Actually, synctex writes down the full path of the source file which is problematic for the situation you describe and also for security reasons because you end up exposing some path on your hard drive.

By default TeX did not offer any facility to make a relative path from an absolute one, mainly because of portability IIRC. I guess it is time to dig into it once more but front ends will have to adapt.