Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@

## Multi-file documents

**Multi-file documents** are supported as follows. If the first line in the current file consists of the text `%!TEX root = <master file name>`, then tex & friends are invoked on the specified master file, instead of the current one. Note: the only file that gets saved automatically is the current one. Also, the master file name **must** have a valid tex extension (i.e., one configured in the `tex_file_exts` settings), or it won't be recognized.
**Multi-file documents** are supported as follows. If the first line in the current file consists of the text `%!TEX root = <master file name>`, then tex & friends are invoked on the specified master file, instead of the current one. Note: the only file that gets saved automatically is the current one. Also, the master file name **must** have a valid tex extension (i.e., one configured in the `tex_file_exts` settings), or it won't be recognized.

As an alternative, to using the `%!TEX root = <master file name>` syntax, if you use a Sublime project, you can set the `latextools.tex_root` option (under `settings`):

As an alternative, to using the `%!TEX root = <master file name>` syntax, if you use a Sublime project, you can set the `TEXroot` option (under `settings`):

```json
{
... <folder-related settings> ...

"settings": {
"TEXroot": "yourfilename.tex"
"latextools.tex_root": "yourfilename.tex"
}
}
```

Note that if you specify a relative path as the `TEXroot` in the project file, the path is determined *relative to the location of the project file itself*. It may be less ambiguous to specify an absolute path to the `TEXroot` if possible.
Note that if you specify a relative path as the `latextools.tex_root` in the project file, the path is determined *relative to the location of the project file itself*. It may be less ambiguous to specify an absolute path to the `latextools.tex_root` if possible.

## Previewing

Expand Down
10 changes: 5 additions & 5 deletions docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,18 @@ Other example formats are provided in the settings file.

## Project-Specific Settings

Any settings can be overridden on a project-specific basis if you are using SublimeText's [project system](https://www.sublimetext.com/docs/3/projects.html). In addition, you can use the `TEXroot` 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 `TEXroot` 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.
Any settings can be overridden on a project-specific basis if you are using SublimeText's [project system](https://www.sublimetext.com/docs/3/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.

To use project-specific settings, simply create a [`"settings"` section in your project file](http://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. Here is an example:
To use project-specific settings, simply create a [`"settings"` section in your project file](http://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:

```json
{
... <folder-related options here> ...

"settings" : {
"TEXroot": "main.tex",
"tex_file_exts": [".tex", ".tikz"],
"builder_settings": {
"latextools.tex_root": "main.tex",
"latextools.tex_file_exts": [".tex", ".tikz"],
"latextools.builder_settings": {
"program": "xelatex",
"options": "--shell-escape"
}
Expand Down
4 changes: 2 additions & 2 deletions latextools_utils/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _get_setting(setting, default=None, view=None):
# no view defined or view invalid
view_settings = {}

result = view_settings.get(setting)
result = view_settings.get('latextools.{}'.format(setting))

if result is None:
result = global_settings.get(setting)
Expand All @@ -51,7 +51,7 @@ def _get_setting(setting, default=None, view=None):
for s in (
advanced_settings.get(setting, {}),
global_settings.get(setting, {}),
view_settings.get(setting, {}),
view_settings.get('latextools.{}'.format(setting), {}),
result
):
# recursively load settings
Expand Down
2 changes: 1 addition & 1 deletion latextools_utils/tex_directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def get_tex_root(view):


def get_tex_root_from_settings(view):
root = view.settings().get('TEXroot', None)
root = view.settings().get('latextools.tex_root', None)

if root is not None:
if os.path.isabs(root):
Expand Down
4 changes: 2 additions & 2 deletions toggle_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _make_panel_entry(t, prefix_map):

def _toggle_setting(setting_name, view):
new_value = not get_setting(setting_name, True, view=view)
view.settings().set(setting_name, new_value)
view.settings().set("latextools.{}".format(setting_name), new_value)
message = "Set '{0}' to '{1}'.".format(setting_name, new_value)
sublime.status_message(message)
print(message)
Expand Down Expand Up @@ -52,7 +52,7 @@ def toggle_setting(index):
print(message)
sublime.status_message(message)
current_settings[index][1] = new_value
view.settings().set(name, new_value)
view.settings().set("latextools.{}".format(name), new_value)
panel_entries[index] = _make_panel_entry(
current_settings[index], prefix_map)

Expand Down