SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2.01k stars 365 forks source link

Setting `output_directory` and `aux_directory` does not have any effect #1087

Open evandrocoan opened 7 years ago

evandrocoan commented 7 years ago

Setting output_directory and aux_directory does not have any effect

When I see the command line, opening the Sublime Text Console I noticed when I choose some as Build With... -> Latex it calls:

Welcome to thread Thread-1390
['texify', '-b', '-p', '--engine=pdftex', '--tex-option="--synctex=1"', 'tcc.tex']
Running "'D:\miktex\bin\texify.EXE' -b -p --engine=pdftex '--tex-option="--synctex=1"' tcc.tex"
Finished normally
1
<class '_latextools_basicBuilder.BasicBuilder'>
8
Welcome to thread Thread-1400
['pdflatex', '-interaction=nonstopmode', '-synctex=1', 'report']
Running "'D:\miktex\bin\pdflatex.EXE' -interaction=nonstopmode -synctex=1 report"
Finished normally

But on my settings I got set up:

    "aux_directory": "cache",
    "output_directory": "cache",

When I run from the command line the command latexmk -pdf -output-directory="cache" -aux-directory="cache" -pdflatex="pdflatex -interaction=nonstopmode" -use-make report.tex, it does creates the files on the cache folder.

How can I make this plugin to put the files on the cache folder?

On my system I got installed MikTex version:

pdflatex --version
MiKTeX-pdfTeX  (MiKTeX 2.9.6300)

using bzip2 version 1.0.6, 6-Sept-2010
compiled with curl version 7.53.1; using libcurl/7.53.1 WinSSL
compiled with expat version 2.2; using expat_2.2.0
compiled with jpeg version 9.2
compiled with liblzma version 50020032; using 50020032
compiled with libpng version 1.6.29; using 1.6.29
compiled with libressl version LibreSSL 2.4.5; using LibreSSL 2.4.5
compiled with MiKTeX Application Framework version 1.6300; using 1.6300
compiled with MiKTeX Core version 1.6300; using 1.6300
compiled with MiKTeX Archive Extractor version 1.6300; using 1.6300
compiled with MiKTeX Package Manager version 1.6300; using 1.6300
compiled with poppler version 0.53.0
compiled with uriparser version 0.8.4
compiled with zlib version 1.2.11; using 1.2.11

Also when I choose to the plugin do a system check, the plugin crashed on:

Reading path for TEXINPUTS...
Reading path for BIBINPUTS...
Reading path for BSTINPUTS...
Checking D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText\sublime_text.exe...
Checking D:\User\Documents\latex\texmfs\install\miktex\bin\texify.exe...
Checking D:\User\Documents\latex\texmfs\install\miktex\bin\pdflatex.exe...
Checking D:\User\Documents\latex\texmfs\install\miktex\bin\xelatex.exe...
Checking D:\User\Documents\latex\texmfs\install\miktex\bin\lualatex.exe...
Checking D:\User\Documents\latex\texmfs\install\miktex\bin\biber.exe...
Checking D:\User\Documents\latex\texmfs\install\miktex\bin\bibtex.exe...
Checking D:\User\Documents\latex\texmfs\install\miktex\bin\bibtex8.exe...
Checking D:\User\Documents\latex\texmfs\install\miktex\bin\kpsewhich.exe...
Exception in thread Thread-1410:
Traceback (most recent call last):
  File "./python3.3/threading.py", line 901, in _bootstrap_inner
  File "D:\SublimeText\Data\Packages\LaTeXTools\system_check.py", line 502, in run
    location = get_gs_command()
NameError: global name 'get_gs_command' is not defined

Which are the lines:

File: LaTeXTools/system_check.py
500: 
501:         program = 'ghostscript'
502:         location = get_gs_command()
503: 
504:         available = location is not None

I think I do not have the ghostscript program installed right now.

r-stein commented 7 years ago

The systemcheck failure seems to be a bug in versions < 3118, but ghostscript usually ships together with miktex.

For the other part I am a little bit confused. Based on your log I assume you have tried both traditional/default and basic builder?

  1. If you are using the traditional builder for miktex with texify the output directory is disabled for technical reasons
  2. On the basic builder it should work
  3. if you want to run latexmk (as the miktex package) you may just change the distro to texlive (I think this should work)
evandrocoan commented 7 years ago

Based on your log I assume you have tried both traditional/default and basic builder?

I think was something like traditional/default & basic.

if you want to run latexmk (as the miktex package) you may just change the distro to texlive (I think this should work)

Thanks! I changed the ditro to texlive now it is working, i.e., creating the cache folder and putting the auxiliary files there.

I do not understand why, I am using MikTex, I neither have TexLive installed. This was the command line choosing Basic Builder:

image

Welcome to thread Thread-1521
making directory D:\DrawLotsAiGame\cache
['pdflatex', '-interaction=nonstopmode', '-synctex=1', '--output-directory=cache', 'report']
Running "'D:\miktex\bin\pdflatex.EXE' -interaction=nonstopmode -synctex=1 --output-directory=cache report"
Finished normally
0
False False True
Jump to:  51 0
<class '_latextools_sumatra_viewer.SumatraViewer'>
Running "'C:\Program Files (x86)\SumatraPDF\SumatraPDF.exe' -reuse-instance -forward-search 'D:\DrawLotsAiGame\report.tex' 52 'D:\DrawLotsAiGame\cache\report.pdf'"

But it is missing the argument -aux-directory="cache", strangely it is creating all the files on the cache folder.

r-stein commented 7 years ago

I do not understand why, I am using MikTex, I neither have TexLive installed.

Actually "miktex" means "use texify" and "texlive" means "use latexmk, because these are the default shipped build programs and we don't need to confuse people more than necessary. (I don't think there are more differences)

But it is missing the argument -aux-directory="cache", strangely it is creating all the files on the cache folder.

I am not sure, but I think -aux-directory is only for texify and -output-directory is only for latexmk.

ig0774 commented 7 years ago

-output-directory redirects all output (auxfiles & PDF) to the specified directory and is supported by both MiKTeX and TeXLive (but not by texify). If you change the distro to texlive, the n LaTeXTools will generate a command line suitable for TeXLive, i.e., only supporting -output-directory.

-aux-directory is only supported by MiKTeX (but again not by texify). If you run the basic builder, it should support both but only if you specify the builder setting as basic. Unfortunately, there isn't yet a way to run the basic builder from the variants and have LaTeXTools realise that it's running the basic builder rather than whatever is configured in your settings, hence the output you see.

latexmk supports both -output-directory and -aux-directory, but only if the underlying distribution supports them. Otherwise, it naïvely passes the arguments along causing builds with -aux-directory to fail if the actual distro is TeXLive.

I'm going to reopen this because there is one bug (in the system check) and one enhancement (to get the builders working correctly when chosen from the variants without modifying the corresponding settings) that we should address.

evandrocoan commented 7 years ago

@Thanks you all for the time!

About the system check bug, I think it is as @r-stein said, because I am using Sublime Text build 3114.

nimafazeli commented 6 years ago

Hi I do not know whether it is because of a bugfix or whether it is the way miktex works. But I found out, somewhat accidentally, that the output_directoryoption actually works even with miktex distribution when it is combined with a tex directive of %!TEX jobname.

Thanks anyways