diff --git a/docs/features.md b/docs/features.md index a8e5f0e01..ecacaf366 100644 --- a/docs/features.md +++ b/docs/features.md @@ -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 = `, 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 = `, 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 = ` 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 = ` syntax, if you use a Sublime project, you can set the `TEXroot` option (under `settings`): - ```json { ... ... "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 diff --git a/docs/settings.md b/docs/settings.md index 3fd83880a..d66077abe 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -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 { ... ... "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" } diff --git a/latextools_utils/settings.py b/latextools_utils/settings.py index e044433ce..bab6b5f6a 100644 --- a/latextools_utils/settings.py +++ b/latextools_utils/settings.py @@ -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) @@ -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 diff --git a/latextools_utils/tex_directives.py b/latextools_utils/tex_directives.py index 9f391798b..6713bf39e 100644 --- a/latextools_utils/tex_directives.py +++ b/latextools_utils/tex_directives.py @@ -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): diff --git a/toggle_settings.py b/toggle_settings.py index 01bfdc604..58387dc1c 100644 --- a/toggle_settings.py +++ b/toggle_settings.py @@ -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) @@ -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)