Snippets in Texifier macOS
This article concerns the
macOS
app.
See other variants:
Windows

Since version 1.5, Texifier has supported Snippets functionality to make it easy to insert regularly used blocks of text into your document. Texifier is distributed with a small number of helpful Snippets, but the system is fully configurable. You may edit them and/or add your own.

docs/apps/workspace/menus/snippets_macos.png

Usage

To use a Snippet, either choose the Snippet from the dropdown menu, or press the associated hotkey – all hotkeys are activated with a control key.

Configuring

All snippets are stored as text files in the Snippets subdirectory of Texifier’s Application Support directory. To open this directory, click the Add/Edit Snippets… option from the top of the Snippets menu.

To delete a snippet delete the file and it will be removed when Texifier is rebooted.

To rename a snippet, rename the file containing the snippet. The file extension is ignored, and will not form part of the snippet name.

To add a snippet, either copy the snippet file into the directory, or create a new file in that directory, with the name you want the snippet to carry.

Syntax

Snippet files are flat text files with a straightforward key = value syntax. Lines beginning with a % sign are interpreted as comments and ignored. All other lines have a key = value syntax.

The key is flattened. That is to say all whitespace, dashes and underscores are stripped and the entire key is rendered into lower case. For example Ctrl-Key, Ctrl key and ctrlkey are all equivalent keys.

If there is no right hand side to the line, then starting with the next line, all lines until the end of the file are used as the value.

An example file follows.

An example snippet
% A snippet to insert an itemize environment
ctrl key = z
group = Environment
insert at cursor =
\begin{itemize}
  \item 
\end{itemize}

Hotkeys: Key combinations associated with snippets

Keys understood by Texifier are

Key Explanation
ctrl key The value must be a single character. It is the key that when pressed with the control key is the hotkey for this snippet.
group The name of the group that this should be displayed in.
insert at cursor The text that should be inserted at the current cursor position. Any currently selected text will be substituted for <SELECTION> and the new selection will be placed around that text.