Skip to content

Commit 7e56db7

Browse files
committed
Update project-specific settings docs
1 parent cdf06e9 commit 7e56db7

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed

docs/settings.md

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,26 +198,59 @@ Other example formats are provided in the settings file.
198198

199199
## Project-Specific Settings
200200

201-
Any settings can be overridden on a project-specific basis if you are using SublimeText's [project system](https://www.sublimetext.com/docs/projects.html). In addition, you can use the `tex_root` setting in the project file only to specify the master tex file instead of using `%!TEX root =` magic comments. If specified in the project file, the `tex_root` will be resolved relative to the location of your `.sublime-project` file. Similarly, if you use `output_directory` or `aux_directory` in the project file, they will be resolved relative to the location of the project file.
201+
Any LaTeXTools settings can be overridden via [`"settings": {}` in sublime-project files](https://www.sublimetext.com/docs/projects.html#settings-key).
202202

203-
To use project-specific settings, simply create a [`"settings"` section in your project file](https://docs.sublimetext.info/en/latest/file_management/file_management.html#the-sublime-project-format). The structure and format is the same as for the `LaTeXTools.sublime-settings` file, but the first level settings are prefixed with `latextools.` to avoid collisions with other packages. Here is an example:
203+
**Note:** Setting keys must be prefixed by `latextools.` to prevent ambiguities with Sublime Text's preferences or settings added by other 3rd-party plugins.
204+
205+
Additionally `latextools.tex_root` setting provides an alternative to `%!TEX root =` magic comments, to specify file path of main TeX document.
206+
207+
**Note:** If specified in project file, `latextools.tex_root`, `latextools.aux_directory` and `latextools.output_directory` are resolved relative to `.sublime-project` file location.
208+
209+
### Example
210+
211+
**Folder structure:**
212+
213+
```
214+
.
215+
├── A Project.sublime-project
216+
├── build/
217+
| ├── aux/
218+
| | ├── .gitignore
219+
| | └── main.aux
220+
| ├── main.pdf
221+
| ├── main.synctex.gz
222+
└── src/
223+
├── chapters/
224+
| ├── chapter1.tex
225+
| ├── ...
226+
| └── chapterN.tex
227+
├── main.tex
228+
└── bibliography.bib
229+
```
230+
231+
**A Project.sublime-project**
204232

205233
```json
206234
{
207-
... <folder-related options here> ...
208-
235+
"folders": [
236+
{
237+
"path": "."
238+
}
239+
],
209240
"settings" : {
210-
"latextools.tex_root": "main.tex",
241+
"latextools.tex_root": "src/main.tex",
211242
"latextools.tex_file_exts": [".tex", ".tikz"],
243+
"latextools.aux_directory": "build/aux",
244+
"latextools.output_directory": "build",
212245
"latextools.builder_settings": {
246+
"builder": "traditional",
213247
"program": "xelatex",
214248
"options": "--shell-escape"
215249
}
216250
}
217251
}
218252
```
219253

220-
This sets `main.tex` as the master tex file (assuming a multi-file project), and allows `.tikz` files to be recognized as tex files. Furthermore (using the default, i.e., traditional builder), it forces the use of `xelatex` instead of the default `pdflatex`, and also adds the `--shell-escape` option. All of these settings will only apply while in the current project.
221-
222-
**Note:** tweaking settings on a project-specific level can lead to subtle issues that can be difficult to track down. If you notice a bug, in addition to resetting your `LaTeXTools.sublime-settings` file, you should remove any LaTeXTools settings from your project file.
254+
This sets _src/main.tex_ as the main tex file (assuming a multi-file project), and allows `.tikz` files to be recognized as tex files. Furthermore (using the default, i.e., traditional builder), it forces the use of `xelatex`, and adds `--shell-escape` option. Intermediate build assets are created in _&lt;dir of project-file&gt;/build/aux/_ and final documents are copied to _&lt;dir of project-file&gt;/build/_.
223255

256+
**Note:** All of these settings apply only, if the project is opened in Sublime Text.

0 commit comments

Comments
 (0)