LaTeX-auto-activating-snippets icon indicating copy to clipboard operation
LaTeX-auto-activating-snippets copied to clipboard

Mirror of https://git.tecosaur.net/tec/LaTeX-auto-activating-snippets

#+title: LaTeX Auto Activating Snippets #+author: tecosaur, ymarco

#+html: #+html:

A chunky set of LaTeX snippets for the [[https://github.com/ymarco/auto-activating-snippets][auto-activating-snippets engine]].

  • Sample Configuration #+begin_src emacs-lisp (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")))) #+end_src

  • Credits [[https://github.com/cdominik/cdlatex][cdlatex]] and this [[https://castel.dev/post/lecture-notes-1/][very nice blog post]].

  • Snippets /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: #+begin_src sh (browse-url-emacs "https://raw.githubusercontent.com/tecosaur/LaTeX-auto-activating-snippets/master/README.org") #+end_src ** Basic set #+begin_src emacs-lisp :exports results (aas--format-doc-to-org 'laas-basic-snippets) #+end_src

#+RESULTS: : Basic snippets. Expand only inside maths.

#+begin_src emacs-lisp :exports results (aas--format-snippet-array laas-basic-snippets) #+end_src

#+RESULTS: | ~!=~ | \neq | | ~!>~ | \mapsto | | ~**~ | \cdot | | ~+-~ | \pm | | ~-+~ | \mp | | ~->~ | \to | | ~...~ | \dots | | ~<<~ | \ll | | ~<=~ | \leq | | ~<>~ | \diamond | | ~=<~ | \impliedby | | ~==~ | &= | | ~=>~ | \implies | | ~>=~ | \geq | | ~>>~ | \gg | | ~AA~ | \forall | | ~EE~ | \exists | | ~cb~ | ^3 | | ~iff~ | \iff | | ~inn~ | \in | | ~notin~ | \not\in | | ~sr~ | ^2 | | ~xx~ | \times | | ~❘->~ | \mapsto | | ~❘=~ | \models | | ~❘❘~ | \mid | | ~∽=~ | \approx | | ~∽∽~ | \sim | | ~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~ | \perp | | ~sin~ | \sin | | ~star~ | \star | | ~gcd~ | \gcd | | ~min~ | \min | | ~max~ | \max | | ~eqv~ | \equiv | | ~CC~ | \CC | | ~FF~ | \FF | | ~HH~ | \HH | | ~NN~ | \NN | | ~PP~ | \PP | | ~QQ~ | \QQ | | ~RR~ | \RR | | ~ZZ~ | \ZZ | | ~;a~ | \alpha | | ~;A~ | \forall | | ~;;A~ | \aleph | | ~;b~ | \beta | | ~;;;c~ | \cos | | ~;;;C~ | \arccos | | ~;d~ | \delta | | ~;;d~ | \partial | | ~;D~ | \Delta | | ~;;D~ | \nabla | | ~;e~ | \epsilon | | ~;;e~ | \varepsilon | | ~;;;e~ | \exp | | ~;E~ | \exists | | ~;;;E~ | \ln | | ~;f~ | \phi | | ~;;f~ | \varphi | | ~;F~ | \Phi | | ~;g~ | \gamma | | ~;;;g~ | \lg | | ~;G~ | \Gamma | | ~;;;G~ | 10^{?} | | ~;h~ | \eta | | ~;;h~ | \hbar | | ~;i~ | \in | | ~;;i~ | \imath | | ~;I~ | \iota | | ~;;I~ | \Im | | ~;;j~ | \jmath | | ~;k~ | \kappa | | ~;l~ | \lambda | | ~;;l~ | \ell | | ~;;;l~ | \log | | ~;L~ | \Lambda | | ~;m~ | \mu | | ~;n~ | \nu | | ~;;;n~ | \ln | | ~;N~ | \nabla | | ~;;;N~ | \exp | | ~;o~ | \omega | | ~;O~ | \Omega | | ~;;O~ | \mho | | ~;p~ | \pi | | ~;;p~ | \varpi | | ~;P~ | \Pi | | ~;q~ | \theta | | ~;;q~ | \vartheta | | ~;Q~ | \Theta | | ~;r~ | \rho | | ~;;r~ | \varrho | | ~;;R~ | \Re | | ~;s~ | \sigma | | ~;;s~ | \varsigma | | ~;;;s~ | \sin | | ~;S~ | \Sigma | | ~;;;S~ | \arcsin | | ~;t~ | \tau | | ~;;;t~ | \tan | | ~;;;T~ | \arctan | | ~;u~ | \upsilon | | ~;U~ | \Upsilon | | ~;v~ | \vee | | ~;V~ | \Phi | | ~;w~ | \xi | | ~;W~ | \Xi | | ~;x~ | \chi | | ~;y~ | \psi | | ~;Y~ | \Psi | | ~;z~ | \zeta | | ~;0~ | \emptyset | | ~;8~ | \infty | | ~;!~ | \neg | | ~;^~ | \uparrow | | ~;&~ | \wedge | | ~;∽~ | \approx | | ~;;∽~ | \simeq | | ~;_~ | \downarrow | | ~;+~ | \cup | | ~;-~ | \leftrightarrow | | ~;;+~ | \oplus | | ~;;-~ | \longleftrightarrow | | ~;*~ | \times | | ~;/~ | \not | | ~;❘~ | \mapsto | | ~;;❘~ | \longmapsto | | ~;~ | \setminus | | ~;=~ | \Leftrightarrow | | ~;;=~ | \Longleftrightarrow | | ~;(~ | \langle | | ~;)~ | \rangle | | ~;[~ | \Leftarrow | | ~;;[~ | \Longleftarrow | | ~;]~ | \Rightarrow | | ~;;]~ | \Longrightarrow | | ~;{~ | \subset | | ~;}~ | \supset | | ~;<~ | \leftarrow | | ~;;<~ | \longleftarrow | | ~;;;<~ | \min | | ~;>~ | \rightarrow | | ~;;>~ | \longrightarrow | | ~;;;>~ | \max | | ~;'~ | \prime | | ~;.~ | \cdot |

** Annoying Subscripts #+begin_src emacs-lisp :exports results (aas--format-doc-to-org 'laas-subscript-snippets) #+end_src

#+RESULTS: : Automatic subscripts! Expand In math and after a single letter.

#+begin_src emacs-lisp :exports results (aas--format-snippet-array laas-subscript-snippets) #+end_src

#+RESULTS: | ~ii~ | X_i, or X_{Yi} if a subscript was typed already | | ~ip1~ | {i+1} | | ~jj~ | X_j, or X{Yj} if a subscript was typed already | | ~jp1~ | {j+1} | | ~nn~ | X_n, or X{Yn} if a subscript was typed already | | ~np1~ | {n+1} | | ~kk~ | X_k, or X{Yk} if a subscript was typed already | | ~kp1~ | {k+1} | | ~0~ | X_0, or X{Y0} if a subscript was typed already | | ~1~ | X_1, or X_{Y1} if a subscript was typed already | | ~2~ | X_2, or X_{Y2} if a subscript was typed already | | ~3~ | X_3, or X_{Y3} if a subscript was typed already | | ~4~ | X_4, or X_{Y4} if a subscript was typed already | | ~5~ | X_5, or X_{Y5} if a subscript was typed already | | ~6~ | X_6, or X_{Y6} if a subscript was typed already | | ~7~ | X_7, or X_{Y7} if a subscript was typed already | | ~8~ | X_8, or X_{Y8} if a subscript was typed already | | ~9~ | X_9, or X_{Y9} if a subscript was typed already |

** The infamous fraction #+begin_src emacs-lisp :exports results (aas--format-doc-to-org 'laas-frac-snippet) #+end_src

#+RESULTS: : Frac snippet. : Expand to a template frac after //, or wrap the object before point if it isn~t /. : : ab/ => \frac{ab}{} : // => \frac{}{}

#+begin_src emacs-lisp :exports results (aas--format-snippet-array laas-frac-snippet) #+end_src

#+RESULTS: | ~/~ | See the docs of `laas-frac-snippet' |

** Simpler Accents #+begin_src emacs-lisp :exports results (aas--format-doc-to-org 'laas-accent-snippets) #+end_src

#+RESULTS: : A simpler way to apply accents. Expand If LaTeX symbol immidiately before point.

#+begin_src emacs-lisp :exports results (aas--format-snippet-array laas-accent-snippets) #+end_src

#+RESULTS: | ~'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 \tilde{} | | ~'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 \acute{} | | ~'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 \tilde{} | | ~hat~ | Wrap in \hat{} | | ~bar~ | Wrap in \overline{} |