I am currently using Windows 7, TeXLive2011, and TeXworks 0.4.3.
I want to put all temporary files in
tmp directory located in the same working directory as the
.tex file. But, I want the final
.tex file, not in
I did the following:
pdflatex -synctex=1 -output-directory=tmp foo.tex
It put all temporary files in
tmp directory, but also
foo.pdf. So, I created a batch file to copy
tmpdirectory to the working directory.
:: %1 = tex file basename (without extension) :: %2 = working directory :: remove quotes in the basename tossed by TeXworks for /f "useback tokens=*" %%a in ('%1') do set basename=%%~a :: remove spaces in the basename tossed by TeXworks set basename=%basename: =% :: change / to \ in the directory name tossed by TeXworks set dirname=%2 set dirname=%dirname:/=\% :: create tmp directory if not exist IF NOT EXIST %dirname%\tmp mkdir %dirname%\tmp pdflatex -synctex=1 -output-directory=tmp %basename%.tex :: open pdf in tmp so that synctex works in TeXworks texworks %dirname%\tmp\%basename%.pdf copy %dirname%\tmp\%basename%.pdf %dirname%\%basename%.pdf
But I have to open
tmp to make the forward/inverse search work in TeXworks. This works good enough to me, except one thing.
After executing the above batch file, TeXworks opens two windows: one for
foo.tex, one for
tmp\foo.pdf. Inverse search from
foo.tex works good, but if I do
foo.tex, it opens
foo.pdf, but synchronizes with
tmp\foo.pdf. Of course,
foo.tex does not synchronize with
foo.pdf, because sync file is written for
If I do not copy
foo.pdf in the original working directory, it works well, because there is no
foo.pdf that TeXworks can open.
Would there be any workaround for this?