Home

Awesome

Obsidian Latex Suite <img src="https://img.shields.io/github/manifest-json/v/artisticat1/obsidian-latex-suite"> <img src="https://img.shields.io/github/downloads/artisticat1/obsidian-latex-suite/total">

A plugin for Obsidian that aims to make typesetting LaTeX math as fast as handwriting.

Inspired by Gilles Castel's setup using UltiSnips.

demo

The plugin's main feature is snippets, which help you write LaTeX quicker through shortcuts and text expansion! For example, type

See Gilles Castel's writeup for more information.

The plugin comes with a set of default snippets, loosely based on Gilles Castel's. You can modify them, remove them, and write your own.

Usage

To get started, type "dm" to enter display math mode. Try typing the following:

Have a look at the cheatsheet for a list of commonly used default snippets.

Once these feel familiar, you can check out the default snippets for more commands. e.g.

You can also add your own snippets! For more info on writing snippets, see here. You can view snippets written by others and share your own snippets here.

Aside from snippets, the plugin also comes with several other features that aim to make writing LaTeX easier.

Features

Auto-fraction

Lets you type "1/x" instead of "\frac{1}{x}".

For example, it makes the following expansions:

and moves the cursor inside the brackets.

Once done typing the denominator, press <kbd>Tab</kbd> to exit the fraction.

auto-fraction

Matrix shortcuts

While inside a matrix, array, align, or cases environment,

matrix shortcuts

Conceal

This feature must be enabled in the plugin settings.

Make your equations more readable by hiding LaTeX markup and instead displaying it in a pretty format.

For example, "\dot{x}^{2} + \dot{y}^{2}" will be displayed as "ẋ² + ẏ²".

"\sqrt{ 1-\beta^{2} }" will be displayed as "√{ 1-β² }".

To reveal the LaTeX syntax, move your cursor over it.

conceal demo 2 conceal demo

Tabout

To make it easier to navigate and exit equations,

Preview inline math

When your cursor is inside inline math, a popup window showing the rendered math will be displayed.

<img width=500 src="https://raw.githubusercontent.com/artisticat1/obsidian-latex-suite/main/gifs/inline_math_preview_1.png"> <img width=650 src="https://raw.githubusercontent.com/artisticat1/obsidian-latex-suite/main/gifs/inline_math_preview_2.png">

Visual snippets

Sometimes you want to annotate math, or cancel or cross out terms. Selecting some math with the cursor and typing

visual snippets

Auto-enlarge brackets

When a snippet containing "\sum", "\int" or "\frac" is triggered, any enclosing brackets will automatically be enlarged with "\left" and "\right".

auto-enlarge brackets

Color and highlight matching brackets

To help make your equations more readable,

color and highlight matching brackets demo

Editor commands

The plugin also adds the following commands to the Command palette:

Snippets

Snippets are shortcuts that allow you to insert certain text based on certain triggers. For example, the default snippet

{trigger: "@l", replacement: "\\lambda", options: "mA"}

will expand "@l" to "\lambda".

Snippets can be edited in the plugin settings. The structure of a snippet is as follows:

{
  trigger: string | RegExp,
  replacement: string,
  options: string,
  priority?: number,
  description?: string,
  flags?: string,
}

Options

Insert tabstops for the cursor to jump to by writing "$0", "$1", etc. in the replacement.

For examples and more details on writing snippets, including regex snippets and function snippets, have a look at the documentation.

You can view snippets written by others and share your own snippets here.

[!WARNING] Snippet files are interpreted as JavaScript and can execute arbitrary code. Always be careful with snippets shared from others to avoid running malicious code.

Cheatsheet

TriggerReplacement
mk$ $
dm$$<br><br>$$
sr^{2}
cb^{3}
rd^{ }
__{ }
sq\sqrt{ }
x/y <kbd>Tab</kbd>\frac{x}{y}
//\frac{ }{ }
"\text{ }
text\text{ }
x1x_{1}
x,.\mathbf{x}
x.,\mathbf{x}
xdot\dot{x}
xhat\hat{x}
xbar\bar{x}
xvec\vec{x}
xtilde\tilde{x}
xund\underline{x}
eee^{ }
invs^{-1}

When running a snippet that moves the cursor inside brackets {}, press <kbd>Tab</kbd> to exit the brackets.

Greek letters

TriggerReplacementTriggerReplacement
@a\alphaeta\eta
@b\betamu\mu
@g\gammanu\nu
@G\Gammaxi\xi
@d\deltaXi\Xi
@D\Deltapi\pi
@e\epsilonPi\Pi
:e\varepsilonrho\rho
@z\zetatau\tau
@t\thetaphi\phi
@T\ThetaPhi\Phi
@k\kappachi\chi
@l\lambdapsi\psi
@L\LambdaPsi\Psi
@s\sigma
@S\Sigma
@o\omega
ome\omega

For Greek letters with short names (2-3 characters), just type their name, e.g. "pi" → "\pi".

Acknowledgements

Contributing

Any contributions and PRs are welcome!

Support

If you like this plugin and want to say thanks, you can buy me a coffee here.

<a href='https://ko-fi.com/J3J6BBZAW' target='_blank'><img height='42' style='border:0px;height:42px;' src='https://cdn.ko-fi.com/cdn/kofi1.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>