SublimeText / LaTeXTools

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

Overwrite texroot in project settings #1393

Closed mafw closed 5 years ago

mafw commented 5 years ago

I was wondering if there is any way to overwrite the texroot project settings for single .tex files in the project? My issue is that I have a Beamer presentation as part of a larger project where I am also writing an article. I have set the .tex file for the article as the root file. The problems occurs when I try to compile the presentation as it calls the .tex file for the article.

To deal with this, I have created a separate project for the presentation. Ideally I would like to keep the presentation as a part of the big project and ignore the texroot project setting when compiling the presentation file.

Is this possible? And does such a workflow make sense, or should I stick to having a project for my presentation and one for my main article?

r-stein commented 5 years ago

The quick and dirty solution would be to open the ST console ctrl+` or View > Show Console and insert the following while having the file open:

view.settings().set('TEXroot', view.file_name())

As an alternative you can use a tex ROOT directive, which points to the file itself. (This should have a higher precedence).

%!TEX root = <the name of our file>
mafw commented 5 years ago

Thank you for the quick reply, that worked wonders!

Not sure if I should open a new issue on this, but is it also possible to assign an output directory in a similar way? I have one defined in my project settings:

"output_directory": "<name of output folder>"

So this problem is the same as the previous one: I want to output the aux files from the Beamer presentation compilation in a different folder than the main .tex file. I was wondering if I can override these settings in a similar way, i.e something like

%!output_directory = <name of output folder>

Thank you again!

r-stein commented 5 years ago

Exactly you can also set those with the tex options

%!TEX output_directory = <path>

You can see the precedence here

mafw commented 5 years ago

Wonderful! Thank you very much for all you help.

Closing this now!