A chunky set of LaTeX snippets for the auto-activating-snippets engine.
(use-package laas
:hook (LaTeX-mode . laas-mode)
:config ; do whatever here
(aas-set-snippets 'laas-mode
;; set condition!
:cond #'texmathp ; expand only while in math
"supp" "\\supp"
"On" "O(n)"
"O1" "O(1)"
"Olog" "O(\\log n)"
"Olon" "O(n \\log n)"
;; bind to functions!
"Sum" (lambda () (interactive)
(yas-expand-snippet "\\sum_{$1}^{$2} $0"))
"Span" (lambda () (interactive)
(yas-expand-snippet "\\Span($1)$0"))
;; add accent snippets
:cond #'laas-object-on-left-condition
"qq" (lambda () (interactive) (laas-wrap-previous-object "sqrt"))))
cdlatex and this very nice blog post.
Note: The rendering on GitHub is a little wonkey. It should be understandable enough, but in any case you can also view this file from emacs:
(browse-url-emacs "https://raw.githubusercontent.com/tecosaur/LaTeX-auto-activating-snippets/master/README.org")
Basic snippets. Expand only inside maths.
!= | ≠ |
!> | \mapsto |
** | ⋅ |
+- | ± |
-+ | \mp |
-> | → |
... | … |
<< | \ll |
<= | \leq |
<> | \diamond |
=< | \impliedby |
== | &= |
=> | \implies |
>= | \geq |
>> | \gg |
AA | ∀ |
EE | ∃ |
cb | ^3 |
iff | \iff |
inn | ∈ |
notin | ¬\in |
sr | ^2 |
xx | × |
❘-> | \mapsto |
❘= | \models |
❘❘ | \mid |
∽= | ≈ |
∽∽ | ∼ |
arccos | arccos |
arccot | \arccot |
arccot | \arccot |
arccsc | \arccsc |
arcsec | \arcsec |
arcsin | arcsin |
arctan | arctan |
cos | cos |
cot | cot |
csc | csc |
exp | exp |
ln | ln |
log | log |
perp | ⊥ |
sin | sin |
star | * |
gcd | gcd |
min | min |
max | max |
eqv | ≡ |
CC | \CC |
FF | \FF |
HH | \HH |
NN | \NN |
PP | \PP |
QQ | |
RR | \RR |
ZZ | \ZZ |
;a | α |
;A | ∀ |
;;A | \aleph |
;b | β |
;;;c | cos |
;;;C | arccos |
;d | δ |
;;d | ∂ |
;D | Δ |
;;D | ∇ |
;e | ε |
;;e | ε |
;;;e | exp |
;E | ∃ |
;;;E | ln |
;f | φ |
;;f | \varphi |
;F | Φ |
;g | γ |
;;;g | lg |
;G | Γ |
;;;G | 10? |
;h | η |
;;h | \hbar |
;i | ∈ |
;;i | \imath |
;I | ι |
;;I | \Im |
;;j | \jmath |
;k | κ |
;l | λ |
;;l | \ell |
;;;l | log |
;L | Λ |
;m | μ |
;n | ν |
;;;n | ln |
;N | ∇ |
;;;N | exp |
;o | ω |
;O | Ω |
;;O | \mho |
;p | π |
;;p | \varpi |
;P | Π |
;q | θ |
;;q | ϑ |
;Q | Θ |
;r | ρ |
;;r | \varrho |
;;R | \Re |
;s | σ |
;;s | ς |
;;;s | sin |
;S | Σ |
;;;S | arcsin |
;t | τ |
;;;t | tan |
;;;T | arctan |
;u | υ |
;U | Υ |
;v | ∨ |
;V | Φ |
;w | ξ |
;W | Ξ |
;x | χ |
;y | ψ |
;Y | Ψ |
;z | ζ |
;0 | ∅ |
;8 | ∞ |
;! | ¬ |
;^ | ↑ |
;& | ∧ |
;∽ | ≈ |
;;∽ | ≅ |
;_ | ↓ |
;+ | ∪ |
;- | ↔ |
;;+ | ⊕ |
;;- | \longleftrightarrow |
;* | × |
;/ | ¬ |
;❘ | \mapsto |
;;❘ | \longmapsto |
;\ | \setminus |
;= | ⇔ |
;;= | \Longleftrightarrow |
;( | \langle |
;) | \rangle |
;[ | ⇐ |
;;[ | \Longleftarrow |
;] | ⇒ |
;;] | \Longrightarrow |
;{ | ⊂ |
;} | ⊃ |
;< | ← |
;;< | \longleftarrow |
;;;< | min |
;> | → |
;;> | \longrightarrow |
;;;> | max |
;' | ′ |
;. | ⋅ |
Automatic subscripts! Expand In math and after a single letter.
ii | X_i, or XYi if a subscript was typed already |
ip1 | i+1 |
jj | X_j, or XYj if a subscript was typed already |
jp1 | j+1 |
nn | X_n, or XYn if a subscript was typed already |
np1 | n+1 |
kk | X_k, or XYk if a subscript was typed already |
kp1 | k+1 |
0 | X_0, or XY0 if a subscript was typed already |
1 | X_1, or XY1 if a subscript was typed already |
2 | X_2, or XY2 if a subscript was typed already |
3 | X_3, or XY3 if a subscript was typed already |
4 | X_4, or XY4 if a subscript was typed already |
5 | X_5, or XY5 if a subscript was typed already |
6 | X_6, or XY6 if a subscript was typed already |
7 | X_7, or XY7 if a subscript was typed already |
8 | X_8, or XY8 if a subscript was typed already |
9 | X_9, or XY9 if a subscript was typed already |
Frac snippet. Expand to a template frac after //, or wrap the object before point if it isn~t /.
:
ab/ => \frac{ab}{} // => \frac{}{}
/ | See the docs of `laas-frac-snippet’ |
A simpler way to apply accents. Expand If LaTeX symbol immidiately before point.
'r | Wrap in \mathrm{} or \textrm{} |
'i | Wrap in \mathit{} or \textit{} |
'b | Wrap in \mathbf{} or \textbf{} |
'e | Wrap in \mathemph{} or \textemph{} |
'y | Wrap in \mathtt{} or \texttt{} |
'f | Wrap in \mathsf{} or \textsf{} |
'l | Wrap in \textsl |
'. | Wrap in \dot{} |
': | Wrap in \ddot{} |
'∽ | Wrap in ˜ |
'N | Wrap in \widetilde{} |
'^ | Wrap in \hat{} |
'H | Wrap in \widehat{} |
'- | Wrap in \bar{} |
'T | Wrap in \overline{} |
'_ | Wrap in \underline{} |
'{ | Wrap in \overbrace{} |
'} | Wrap in \underbrace{} |
'> | Wrap in \vec{} |
'/ | Wrap in \grave{} |
'" | Wrap in ´ |
'v | Wrap in \check{} |
'u | Wrap in \breve{} |
'm | Wrap in \mbox{} |
'c | Wrap in \mathcal{} |
'0 | Wrap in {\textstyle } |
'1 | Wrap in {\displaystyle } |
'2 | Wrap in {\scriptstyle } |
'3 | Wrap in {\scriptscriptstyle } |
'q | Wrap in \sqrt{} |
..␣ | Wrap in \dot{} |
,. | Wrap in \vec{} |
., | Wrap in \vec{} |
∽␣ | Wrap in ˜ |
hat | Wrap in \hat{} |
bar | Wrap in \overline{} |