-
Notifications
You must be signed in to change notification settings - Fork 535
Environments
- To start a new environment, you can type
\begin
and select the begin a new environment snippet. A multi-cursor is added to enter the environment name simultaneously in thebegin
andend
commands. - 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. - 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
). - 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{...}
. Repeated calls result in selecting the outer environment. 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
). 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.
- 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.