-
Notifications
You must be signed in to change notification settings - Fork 536
Environments
- To start a new environment, you can type
\begin
and use intellisense. See Intellisense for Environments for a detailed explanation of the different mechanisms. - Most environments can also be started by simply typing
\
followed by the environment name. For instance, to start enequation
environment, type\equation
and choose the\begin{equation}...\end{equation}
snippet. See Intellisense for Environments - Some common environments have specific snippets of the form
B
+ the first two or three letters of the environment name, see the full list. - To surround some selected text with an environment, call LaTeX Workshop: Surround/wrap selection with \begin{}...\end{} from the Command Palette (command
latex-workshop.wrap-env
). A multi-cursor is added inside the braces, to insert the environment name.
When the current line starts with \item
or \item[]
, hitting Enter
automatically adds a newline starting in the same way. For a better handling of the last item, hitting Enter
on a line only containing \item
or \item[]
actually deletes the content of the line. The alt+Enter
key is bind to the standard newline command.
This automatic insertion of \item
can be deactivated by setting latex-workshop.bind.enter.key
to false
.
In any case, you can use the shortcut ctrl+l, ctrl+Enter to insert a newline and \item
. On Mac, ctrl is replaced by ⌘.
- To navigate from
\begin/\end
to the corresponding\end/\begin
, while on thebegin
orend
keywords, call LaTeX Workshop: Navigate to matching begin/end from the Command Palette (commandlatex-workshop.navigate-envpair
). This function considers blocks surrounded by\[...\]
,$$...$$
,\(...\)
or$...$
as environments. - To select the inner content of an environment, excluding the opening and closing statements, call LaTeX Workshop: Select the current environment content from the Command Palette (command
latex-workshop.select-envcontent
). This function considers blocks surrounded by\[...\]
,$$...$$
,\(...\)
or$...$
as environments. Repeated calls result in selecting the outer environments. - To select the whole environment, including the opening and closing statements, call LaTeX Workshop: Select the current environment from the Command Palette (command
latex-workshop.select-env
). This function considers blocks surrounded by\[...\]
,$$...$$
,\(...\)
or$...$
as environments. Repeated calls result in selecting the outer environments. - To select the current environment name, call LaTeX Workshop: Select the current environment name from the Command Palette (command
latex-workshop.select-envname
). For this command to work, the cursor must be strictly between\begin{...}
and\end{...}
. If the current environment is\[...\]
, this function will automatically convert it into\begin{equation*}...\end{equation*}
. Repeated calls result in selecting the outer environments. Note: this function does not work with the Vim extension. - To add a multi-cursor to the current environment name, call LaTeX Workshop: Add a multi-cursor to the current environment name from the Command Palette (command
latex-workshop.multicursor-envname
). If the current environment is\[...\]
, this function will automatically convert it into\begin{}...\end{}
. For this command to work, the cursor must be strictly between\begin{...}
and\end{...}
. Repeated calls result in selecting the outer environments.
These three functions are directly available from the TeX badge.
- The commands
latex-workshop.select-envname
andlatex-workshop.multicursor-envname
described above, allow one to change a pair of\[...\]
into any other math environment (e.g.equation
oralign
). - To go backwards, call LaTeX Workshop: Toggle between \[...\] and \begin{}...\end{} from the Command Palette (command
latex-workshop.toggle-equation-envname
). This command changes\[...\]
to\begin{equation*}...\end{equation*}
(without moving the cursor) and it changes the following environments to\[...\]
:equation, align, flalign, alignat, gather, multline, eqnarray
(and their starred variants).
- To auto close LaTeX environments, call LaTeX Workshop: Close current environment from the Command Palette (command function
latex-workshop.close-env
).
To surround some selected text with an environment, call LaTeX Workshop: Surround/wrap selection with \begin{}...\end{} from the Command Palette (command latex-workshop.wrap-env
). A multi-cursor is added inside the braces, to insert the environment name.
Alternatively, you can select the text and insert the environment using either the \envname
command or the \beginend
snippet but not the \begin
snippet.
Enable the automatic insertion of \item
on a newline when pressing Enter
in a line starting in \item
.
type | default value |
---|---|
boolean | true |
Enable AST based smart selection. Command ids are editor.action.smartSelect.expand
and editor.action.smartSelect.shrink
.
type | default value |
---|---|
boolean | true |