This extension provides a variety of intellisense completions for different LaTeX features; notably for citations, labels, and file names. Intellisense suggestions are updated on file save but a more aggressive updating strategy can be used by setting intellisense.update.aggressive.enabled
to true
.
Every file of a LaTeX project is parsed to look for bibliography resources, either directly in a thebibliography
environment or given by the bibliography
or addbibresource
commands or variants of them. If some of these resources are located outside the project directly, you need to list the directories where to look for them in latex-workshop.latex.bibDirs
.
Then, when citation commands like \cite
and its derivatives are automatically completed with bibliography entries found in the various resources.
If you use very large bibtex files, you may experience temporary freezing. Hence, files larger than 5MB are ignored (see latex-workshop.intellisense.citation.maxfilesizeMB
).
Setting key | Description | Default | Type |
---|---|---|---|
latex-workshop.intellisense.citation.label |
Citation property used as suggestion | "bibtex key" |
string: "bibtex key" | "title" | "authors" |
latex-workshop.intellisense.citation.format |
List of fields to display | array of strings | |
latex-workshop.intellisense.citation.maxfilesizeMB |
Maximum bibtex file size (in MB) | 5 |
float |
latex-workshop.intellisense.citation.type |
Type of vs code suggestion to use | "inline" |
string: "inline" | "browser" (dropdown menu) |
latex-workshop.intellisense.package.enabled |
Enabling of auto-completion for commands and environments from loaded packages | false |
boolean |
latex-workshop.latex.bibDirs |
List of paths to look for .bib files. |
[] |
array of strings |
Similarly as for the citation mechanism, all files of a LaTeX project are search for labels. We scan labels defined as \label{...}
or label={...}
. If you do prefer to ignore label={...}
, set latex-workshop.intellisense.label.keyval
to false.
Any \ref
related command is automatically completed with label keys.
The key \
automatically triggers completion of LaTeX commands. Several mechanisms play together to build the list of available commands.
- A set of standard LaTeX commands is provided in the file
data/commands.json
. You may overwrite some of these commands by using thelatex-workshop.intellisense.commandsJSON.replace
configuration variable. - The files of a LaTeX project are searched for any already used commands in the form
mycommand
followed by several{}
groups. Then, a snippet is dynamically built for each of them and they are added to the command completion list. - When
latex-workshop.intellisense.package.enabled
istrue
, the command completion list is also populated with the commands provided by all the standard packages used in the project (through\usepackage
). The list of commands provided by every package is described here. Note that homemade packages are ignored in this mechanism because they do not come with a.cwl
file. - If you use personal macro files and want them to be taken into account by intellisense but store them in some
texmf
structure or dedicated directory. Just add the directory containing the file tolatex-workshop.latex.texDirs
. The file must be loaded in the LaTeX project through the\input
macro. - The completion list can use either placeholders or tabstops. The default is to use tabstops, but it can be changed using
latex-workshop.intellisense.useTabStops.enabled
.- placeholders: they provide meaningful information on the arguments but prevent any autocompletion trigger.
- tabstops: they enable us to directly trigger autocompletion again for citations and references.
- We provide one entry in the intellisense completion list per LaTeX command signature. If you feel, it makes the completion list too long, set
latex-workshop.intellisense.optionalArgsEntries.enabled
tofalse
.
Setting key | Description | Default | Type |
---|---|---|---|
latex-workshop.intellisense.package.enabled |
Enabling of auto-completion for commands and environments from loaded packages | false |
boolean |
latex-workshop.intellisense.package.extra |
Extra packages to load for intellisense | [] |
array of strings |
latex-workshop.intellisense.unimathsymbols.enabled |
Show unimath symbols as suggestions when \ pressed |
false |
boolean |
latex-workshop.intellisense.useTabStops.enabled |
Use tabstops in intellisense completion | true |
boolean |
latex-workshop.intellisense.optionalArgsEntries.enabled |
Add one completion item per command signature | true |
boolean |
latex-workshop.latex.texDirs |
List of paths to look for input .tex files. |
[] |
array of strings |
Completion for environments works similarly as for commands. It is based on a set of predefined environments enriched with those defined by the included packages when latex-workshop.intellisense.package.enabled
is true
. Moreover, any custom environment is added to the list after being used once.
We support intellisense for file completion inside the following commands : include
, includegraphics
, input
, and all the commands from the import
package. For the includegraphics
command, we take into account the paths defined by \graphicspath
if any.
Note that any file matching one of the patterns listed in the following variables is removed from the list: files.exclude
, latex-wokrshop.intellisense.file.exclude
. Moreover, if search.useIgnoreFiles
is true, any file listed in a .gitignore
is also removed from the completion list.
To check if a file is indeed listed by a .gitignore
file, you can run
git check-ignore -v full_path_to_the_file
Whether or not to preview graphics for \includegraphics
.
type | default value |
---|---|
boolean | true |
Defines what to show as suggestion labels when intellisense provides citation suggestions.
- bibtex key: Show bibtex keys in the inline intellisense.
- title: Show publication titles in the inline intellisense.
- authors: Show publication authors in the inline intellisense.
type | default value |
---|---|
string | "bibtex key" |
List of fields to display for citation preview and intellisense. You must reload VSCode to take into account a change in this configuration.
type | default value |
---|---|
array of strings | ["author", "title", "journal", "publisher", "booktitle", "year"] |
Define the maximum bibtex file size for the extension to parse in MB.
type | default value |
---|---|
float | 5 |
Define which type of hint to show when intellisense provides citation suggestions.
- inline: Use the inline intellisense to provide citation completion items.
- browser: Use a dropdown menu to provide citation completion items.
type | default value |
---|---|
string | "inline" |
Auto-complete commands and environments from used packages.
type | default value |
---|---|
boolean | false |
List of extra packages to always add to the auto-completion mechanism.
When latex-workshop.intellisense.package.enabled
is set to true
, the commands and environments defined in these extra packages will be added to the intellisense suggestions
type | default value |
---|---|
array of strings | [] |
Many LaTeX commands can have several signatures, each with different arguments. If set to True, the intellisense completion list will have one entry for each form of a given command.
type | default value |
---|---|
boolean | true |
Use tabstops instead of placeholders in intellisense. Tabstops enable us to directly trigger autocompletion again (particularly useful for citations and references). On the contrary, placeholders prevent any direct call to autocompletion but they provide more information on the arguments meaning.
type | default value |
---|---|
boolean | true |
Reload vscode after change.
Scan for labels defined as label={some tex}
to add to the reference intellisense menu. The braces are mandatory.
type | default value |
---|---|
boolean | true |
When \
is typed, show unimath symbols in the dropdown selector.
type | default value |
---|---|
boolean | false |
Dictionary of "snippet name": "snippet action"
to replace the default snippets in data/commands.json
. Snippet actions should not begin with a \
. See data/commands.json
for the list of snippet names. An empty action removes the snippet. E.g. { "latexdisplaymath": "[ ${1} \\]", "figure": "" }
. Reload vscode to make any change in this configuration effective
type | default value |
---|---|
dictionary of string: string | {} |
List of directories where to look for .bib
files.
Absolute paths are required. This setting is only used by the intellisense feature, you may also need to set the environment variable BIBINPUTS
properly for the LaTeX compiler to find the .bib
files.
type | default value |
---|---|
array of strings | [] |
Patterns to ignore in file completion
type | default value |
---|---|
array of strings | [ "**/*.aux", "**/*.bbl", "**/*.bcf", "**/*.blg", "**/*.idx", "**/*.ind", "**/*.lof", "**/*.lot", "**/*.out", "**/*.toc", "**/*.acn", "**/*.acr", "**/*.alg", "**/*.glg", "**/*.glo", "**/*.gls", "**/*.ist", "**/*.fls", "**/*.log", "**/*.fdb_latexmk", "**/*.synctex.gz", "**/*.run.xml" ] |
Specify the base directory for file completion. The possible choices are
- Completion from the root file directory
- Completion from the current file directory
- both
type | default value |
---|---|
enum | "root relative"|"file relative"|"both" |
Defines whether the extension aggressively parses the changed content after stopped typing.
Disable this config will let the extension only update intellisense after saving changed files.
type | default value |
---|---|
boolean | false |
Defines the delay in milliseconds for the extension to update current active file content for intellisense after stopped typing.
This config works only when intellisense.update.aggressive.enabled
is enabled. Lower this value will let the extension to know newly defined commands/references/environments more quickly, at the cost of more frequent content parsing: more computation burden.
type | default value |
---|---|
number | 1000 |
While editing a .bib file, hitting @
triggers completion for adding a new entry.
The available completions are described in data/bibtex-entries.json. The user can override any entry by redefining it in the variable [latex-workshop.intellisense.bibtexJSON.replace
].
The entries are formatted according to the variables already used for bibtex formatting:
latex-workshop.bibtex-format.tab
latex-workshop.bibtex-format.surround
latex-workshop.bibtex-format.case
Dictionary of "entry name": ["array", "of", "fields"]
to replace the default fields used in data/bibtex-entries.json. Reload vscode to make any change in this configuration effective.
type | default value |
---|---|
dictionary of string: string | {} |