Open randolf-scholz opened 5 years ago
there seems no to be an easy solution as synctex itself determines the filename of the synctex file. I don't see much benefit in spending much time on cosmetics (especially as there is a clean aux files command)
especially as there is a clean aux files command
@sunderme This could waste time for a complex document which needs several compilations to become stable.
Actually TexStudio (and TexLive executables) only need the .pdf and .synctex.gz to be in the same directory. The .tex file can be in a separate directory.
In my case I keep all the output files (.aux, .synctex.gz, .pdf, .log) in a separate directory. /root/texout is my output directory and I have changed the "Build & view" command to
txs:///custom_build | txs:///view (Repeat is turned off for "Build & view" command)
and then defined a custom command "custom_build:" pdflatex -synctex=1 -interaction=nonstopmode -output-directory=/root/texout %.tex (Repeat is turned on for the custom command. You will need a new version of TexStudio from GitHub since the old versions before .16 do not handle correctly Repeat for custom commands)
/root/texout is also added to "Additional search paths" for "Log file" and "PDF file"
This keeps the output files in a separate directory and also takes care of the complex tex files that need multiple compilation passes (as dbitouze mentioned).
I would also greatly appreciate this feature. synctex
actually offers a -d
parameter, so adding support for this could be done by adding an input field "Synctex file" under "Additional Search Paths" in the "Build" tab and passing this path to synctex
.
The solution of @randolf-scholz doesn't seem to work perfectly on my machine, synctex
only works when I don't specify the rm_sync
command, so I always have the synctex.gz
file in my working directory which is not ideal.
Also note that the process can be greatly accelerated by using ln
instead of cp
(with hard links, it's actually safe to delete the build folder).
It would actually be great if TeXstudio offered dedicated support for build directories, since "Clean auxiliary files" is a lot of hassle that isn't necessary.
I like to keep all the mess that are the auxiliary files in a directory called
__tex__
. However, I noted that synctex only works when the%.synctex.gz
,%.pdf
and%.tex
file are all in the same directory. I was able to get it working via settingBuild & View:
txs:///compile | txs:///copy_sync | txs:///move_pdf | txs:///view | txs:///rm_sync
where
copy_sync
iscp -f __tex__/%.synctex.gz %.synctex.gz
move_pdf
iscp -f __tex__/%.pdf %.pdf
rm_sync
isrm %.synctex.gz
apart from that I use
precompile
:mkdir -p __tex__
to create the__tex__
directory and compile withpdflatex -synctex=1 -interaction=nonstopmode --output-directory=__tex__ %.tex
Now while this works it seems like quite a hassle considering that
synctex
allows to specify the directory of the sync file explicitly. Maybe one could simply expose synctex in the commands list as well?