Latest version of LaTeXtools has changed the behaviour of <<temp>>
for
"aux_directory": "<<temp>>"
as it also copies .synctex.gz
next to the source .tex. I understand that temp is not permanent and if you leave there the .synctex.gz
file the sync between .pdf and .tex would be lost after exiting the session. But a IMHO a more reasonable solution would be to refer to the temp .synctex.gz
file if it is there, in temp, and leave out all the sync to not clutter the original folder with files .synctex.gz
added to the .tex
and .pdf
files, which are the real and final files you want to keep as has been before.
Aux_directory and sync files in LaTexTools
It is not related to where aux_directory is located, but how latex tool chain is creating PDF files and how it impacts viewers, which display those documents in the meanwhile.
As LaTeXTools opens the final document in viewer, synctex also needs to be located next to it for forward/backward search to work. Both being copied to final folder was requested by https://github.com/SublimeText/LaTeXTools/issues/1645.
This strategy is also required to workaround various complains about viewers not displaying updated PDF files or flickering during build as latex tool chain manipulates PDF multiple times.
Long story Short: This is how it is and is going to be working.
see also: https://github.com/SublimeText/LaTeXTools/issues/1645
Maybe a solution for this would be to make your own script to delete the .synctex.gz
file when you close your .tex
file. Something along the lines of
import os
import sublime
from sublime_plugin import EventListener
class ClearSynctexFilesHandler(EventListener):
def on_pre_close(self, view):
if not view.match_selector(0, "text.tex.latex"):
return
else:
tex_path = view.file_name()
base, _ = os.path.splitext(tex_path)
synctex_path = base + ".synctex.gz"
try:
os.remove(synctex_path)
except FileNotFoundError:
pass
to be saved as clear_synctex_files_on_closing.py
in your Packages/User/
folder?
But that would be a bit systematic.
Would it be possible to turn off the generation of synctex files entirely using the LaTexTools options? I never use the backward search feature (in fact, it won’t work on my system), and I would prefer to not have these files clutter the original folder.
It seems like the underlying latexmk command would allow for this.
Traditional builder can run fully custom build commands, but everything including viewer plugins is designed to support backward search. There’s not much point in reworking everything just because a single extra file next to a PDF, which can easily be ignored in a git repo, or hidden from ST’s sidebar if one’s really too sensitive to be disturbed by it.