latex.tmbundle
latex.tmbundle copied to clipboard
Use -output-directory=DIR with latexmk
HI! Thanks for this great bundle!
I wonder if there is the possibility to make the -output-directory parameter work with latexmk. If I add the parameter to the options dialog in the Preferences window, it is simply ignored.
If I issue the command latexmk -pdf -output-dir=out file.tex from the Terminal I obtain the correct output inside the out directory.
Hi teored90,
I wonder if there is the possibility to make the
-output-directoryparameter work withlatexmk.
currently this is not possible. I like the idea behind the option (keep the project directory clean). However, the way this option works is not that helpful, since latexmk also saves the output file (.pdf, .ps) in output-directory. For now, I will consider adding this feature sometimes in the future. Since I do not think that the feature is very useful, but requires larger changes to the bundle, it might take some time till I have a look at it.
If I add the parameter to the options dialog in the Preferences window, it is simply ignored.
The options specified in the preferences are for to the engine (pdlfatex, xelatex, …) and not for latexmk. pdflatex also supports the option -output-directory. For example the following command
pdflatex -output-directory output test.tex
stores all files in the directory output. For that to work, the directory output has to exist beforehand. Since all commands in the LaTeX bundle assume that the output file (.pdf, .ps) is located in the same directory as the master file, specifying the option -output-directory output inside the bundle preferences, will not be very helpful. “Typeset & View (PDF)” will simply fail to display the produced PDF.
If I issue the command
latexmk -pdf -output-dir=out file.texfrom the Terminal I obtain the correct output inside the out directory.
There is a small typo in your command. The option is either called -outdir= or -output-directory=.
Kind regards, René
It would be a nice feature.
A possible hack if you want to watch a file called foo.tex is to set a latexmkrc file as: $pdf_previewer = 'open -a Skim'; $pdflatex = 'lualatex -synctex=1 -interaction=nonstopmode'; $out_dir = 'output'; @generated_exts = (@generated_exts, 'synctex.gz');
And then run: latexmk -quiet -bibtex -pvc -f -pdf foo.tex
Finally you need to make a symbolic link: ln -s output/foo.pdf foo.pdf
However, it would be better to have a similar feature in latex.tmbundle