GithubHelp home page GithubHelp logo

tecosaur / latex-auto-activating-snippets Goto Github PK

View Code? Open in Web Editor NEW
99.0 8.0 24.0 103 KB

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

License: GNU General Public License v3.0

Emacs Lisp 100.00%
emacs emacs-package mirror

latex-auto-activating-snippets's Introduction

LaTeX Auto Activating Snippets

A chunky set of LaTeX snippets for the auto-activating-snippets engine.

Sample Configuration

(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"))))

Credits

cdlatex and this 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:

(browse-url-emacs "https://raw.githubusercontent.com/tecosaur/LaTeX-auto-activating-snippets/master/README.org")

Basic set

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
∽=
∽∽
arccosarccos
arccot\arccot
arccot\arccot
arccsc\arccsc
arcsec\arcsec
arcsinarcsin
arctanarctan
coscos
cotcot
csccsc
expexp
lnln
loglog
perp
sinsin
star*
gcdgcd
minmin
maxmax
eqv
CC\CC
FF\FF
HH\HH
NN\NN
PP\PP
QQ\QQ
RR\RR
ZZ\ZZ
;aα
;A
;;A\aleph
;bβ
;;;ccos
;;;Carccos
;dδ
;;d
;DΔ
;;D
;eε
;;eε
;;;eexp
;E
;;;Eln
;fφ
;;f\varphi
;FΦ
;gγ
;;;glg
;GΓ
;;;G10?
;hη
;;h\hbar
;i
;;i\imath
;Iι
;;I\Im
;;j\jmath
;kκ
;lλ
;;l\ell
;;;llog
;LΛ
;mμ
;nν
;;;nln
;N
;;;Nexp
;oω
;OΩ
;;O\mho
;pπ
;;p\varpi
;PΠ
;qθ
;;qϑ
;QΘ
;rρ
;;r\varrho
;;R\Re
;sσ
;;sς
;;;ssin
;SΣ
;;;Sarcsin
;tτ
;;;ttan
;;;Tarctan
;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
~;’~
;.

Annoying Subscripts

Automatic subscripts! Expand In math and after a single letter.
iiX_i, or XYi if a subscript was typed already
ip1i+1
jjX_j, or XYj if a subscript was typed already
jp1j+1
nnX_n, or XYn if a subscript was typed already
np1n+1
kkX_k, or XYk if a subscript was typed already
kp1k+1
0X_0, or XY0 if a subscript was typed already
1X_1, or XY1 if a subscript was typed already
2X_2, or XY2 if a subscript was typed already
3X_3, or XY3 if a subscript was typed already
4X_4, or XY4 if a subscript was typed already
5X_5, or XY5 if a subscript was typed already
6X_6, or XY6 if a subscript was typed already
7X_7, or XY7 if a subscript was typed already
8X_8, or XY8 if a subscript was typed already
9X_9, or XY9 if a subscript was typed already

The infamous fraction

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’

Simpler Accents

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 ˜
hatWrap in \hat{}
barWrap in \overline{}

latex-auto-activating-snippets's People

Contributors

hpfr avatar justbur avatar lizhuohua avatar miciah avatar tecosaur avatar ymarco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

latex-auto-activating-snippets's Issues

How to disable some snippets in user configuration?

This plugin is very useful and convenient, but some snippets are realy annoying in particular environment, such as the cb expends to ^3 when I writing the tensor index. Is there a way to disable some snippets?

(use-package! lass
  :config
  (setq laas-basic-snippets (remove "cb" laas-basic-snippets))
  (setq laas-basic-snippets (remove "^3" laas-basic-snippets))
)

I've added this code in my configuration file, but it didn't effect anything.

Feature request: Automatic underscores for Greek letters

It would be useful if the automatic underscores also worked for Greek letters, such that when there is a \alpha and I type 1 not \alpha1 but \alpha_1 appears.

(This would be useful, but TBH if this is not easily doable, I would prioritize #30 over this, because this is just a feature, which would make this package more useful/better, the other one is a bug, which makes it unusable, for people, who are working a lot with siunitx/chemical environments.)

`jmath` snippet deletes the last character

jmath

As the title suggests, when the jmath snippet auto-expands (in both in-line and display math modes), it removes the last character h and replaces it by a j with a .5-second delay (see GIF above).

Haven't encountered this issue with any other snippets so far.

`laas--shut-up-smartparens` doesn't work

I was getting duplicated parens when inserting fractions and tracked down the issue to smartparens-mode.

It seems like laas tries to handle this through the function laas--shut-up-smartparens, so I was surprised that it wasn't working.

However, when deciding whether it needs to manipulate the post-self-insert-hook, it checks the default value of post-self-insert-hook rather than the present (potentially local) value. As far as I can tell, smartparens-mode modifies this hook locally and does not alter the default value. As a result, laas--shut-up-smartparens erroneously believes that it does not need to shut up smartparens-mode even though it should.

Maximum two characters in exponent auto curly wrap

Expected Behavior

  • a^123 -> a^{123
  • a^123 -> a^{123}
  • a^-33x -> a^{-33x}

Should the power include non-numeric characters (ex. variable names, ;)? That runs the risk of consuming too much, but I vote that the exponent should be considered incomplete until a whitespace character is typed.

Current Behavior

  • a^123 -> a^{12}3
  • a^123 -> a^{12}3
  • a^-33x -> a^{-3}3x

(tested in org-mode)

Smart Fraction snippet

Hey there,
really good work, thank you.
I'm sorry to bother but I can't get how to active the smart fraction function. I found it in the code but can't find any docs referring to it.
Could you help me?

I'm kind of new to emacs
Thanks

~SM

Install help?

Hi! Emacs newbie here, this package looks amazing! I can't seem to install it though...

I'm trying to use laas with org mode and after manually (load laas.el)ing, I have

(use-package aas
  :hook (LaTeX-mode . auto-activating-snippets-mode)
  :hook (org-mode   . auto-activating-snippets-mode)

  :config (require 'laas))

(use-package laas)

Which is mostly copied from #1.

Do I also need to install/setup yasnippet or other dependencies for the smart fraction?

Any suggestions would be greatly appreciated. Thanks!

In org-mode, a sentence that ends with a latex symbol will be wrapped in \dot{}

For example, if I want to type two sentences:

This sentence ends with a latex fragment \(x\). This is another sentence.

However, when I type .␣, the "wrap in \dot{}" rule is activated.

The root cause is that laas-org-mathp function cannot precisely determine whether the point is within a math block. According to the document of org-element-at-point, it only finds the closest element around the point. So even if the point is outside the math block, laas-org-mathp still return t.

Can we simply disable the rule .␣? Since we have another rule ..␣ which does exactly the same thing.

unicode-math: how to use laas-unicode; smart-frac; and smart subscripts

Hey,

how can I use the laas-unicode file? I did not manage to use it. The simple use-package does not work, which makes sense, since laas-unicode is not provided as a package on elpa.

Also, I think it would be great, if the smart-frac also expands, when there is a unicode-greek-letter and then the /.
The same is also true for the smart subscripts. I think it would be the best to have a variable, where the user can add symbols to the list of symbols, for which the smart-frac and the subscripts work.

I would implement those 2 things myself, as I think this only needs a few lines of code in the right conditions (I think laas-object-on-left-condition and laas-auto-script-condition) plus the definition of the list, but I know too few emacs-lisp to achieve it. Because of this I would be grateful, if someone implements these features and I think many more users can and will benefit from them.

Lastly, I want to thank you for this great package!

Using laas to activate yasnippet snippet

Hi, thank you for the amazing package!

I'm trying to use laas to auto activate a yasnippet snippet. However, doing this breaks the TAB motion inside the snippet.

I'm trying to auto-trigger this yasnippet snippet, which is defined in a separate file in my yasnippet directory:

# -*- mode: snippet -*-
# name: begin-environment
# key: beg
# condition: (looking-back "^beg" nil)
# --
\begin{$1}
$2
\end{$1}

And to auto-trigger it I'm using this in the laas configuration:

"beg" (lambda () (interactive)
                        (yas-expand-snippet "beg")
                        (yas-expand))

This way, writing "beg" at the beginning of a line it writes

\begin{}

\end{}

with the cursor inside the \begin clause. Up to this point everything is as expected, but if I write something (e.g. equation) it gets written only in the \begin clause, and not in the \end close, as the yasnippet marker $1 indicates. Also, pressing TAB just inserts a TAB instead of going to the next marker $2. Is there a way to make it work properly?

Ensure entire expression is within math before expansion

I've run into this strange issue where if I write a formula in org with laas-mode enabled, and then end a sentance after the math fragment the snippet is still activated.

For example in an org-mode before enter: hello \( some-math \). . The entire latex math fragment is wrapped in resulting in \\dot{( nm = -3 \)}.

Add method to set laas-accent-snippets into documentation

I need to change ,. -> \vec{} snippet to ,. -> \symbfit{} and I figured out to copy code here and use a setq function.

(setq laas-accent-snippets
  `(:cond laas-object-on-left-condition
    ,@(cl-loop for (key exp) in '((". " "dot")
                                  (".. " "dot")
                                  (",." "symbfit")
                                  (".," "symbfit")
                                  ("~ " "tilde")
                                  ("hat" "hat")
                                  ("bar" "overline"))
               collect :expansion-desc
               collect (format "Wrap in \\%s{}" exp)
               collect key
               ;; re-bind exp so its not changed in the next iteration
               collect (let ((expp exp)) (lambda () (interactive)
                                           (laas-wrap-previous-object expp)))))
)

Besides, as I have tested, this variable must be set before laas package was loaded. For example, when using use-package, this fragment of code must be put in :init block.

I think the method to set laas-accent-snippets should be added into document for reference.

Modification of laas-identify-adjacent-tex-object to avoid error

To find error:

Make a new buffer, make the first chacters in buffer $A$.

Put point on right side of A and type /.

Get an error eval: Wrong type argument: number-or-marker-p, nil.

This modification should fix that.

(defun laas-identify-adjacent-tex-object (&optional point)
  "Return the starting position of the left-adjacent TeX object from POINT."
  (save-excursion
    (goto-char (or point (point)))
    (cond
     ((memq (char-before) '(?\) ?\] ?\$)) ; add $ environment symbol
      (backward-sexp)
      (point))
     ((= (char-before) ?})
      (cl-loop do (backward-sexp)
               while (= (char-before) ?}))
      ;; try to catch the marco if the braces belong to one
      (when (looking-back "\\\\[A-Za-z@*]+" (line-beginning-position))
        (goto-char (match-beginning 0)))
      (when (memq (char-before) '(?_ ?^ ?.))
        (backward-char)
        (goto-char (laas-identify-adjacent-tex-object))) ; yay recursion
      (point))
     ((or (<= ?a (char-before) ?z)
          (<= ?A (char-before) ?Z)
          (<= ?0 (char-before) ?9))
      (backward-word)
      (when
	  (when (char-before) 		; make sure there is char before :)
	    (= (char-before) ?\\) (backward-char)))
      (when (memq (char-before) '(?_ ?^ ?.))
        (backward-char)
        (goto-char (laas-identify-adjacent-tex-object))) ; yay recursion
      (point))))

Its a corner case, still, figured I would try to patch.

combine with siunitx

Hi,
very interesting snippets approach... is there some thinking about handling siunitx with the convenient approach as well?
It would be great if the units get converted like m gets converted to \m and e.g. kg to \kg... but only if it is located in the second part of the SI-environment $\SI{10}{\m}... maybe this already possible!?

Thank you in advance!

Fab

Insert math symbols outside of LaTeX math mode

Great package! These auto-activating-snippets make a huge difference with the amount of LaTeX math that I write.

This is not really an issue, but instead I'm looking for an example of how to insert a math symbol outside of math mode.

In my attempt below, I define a function notmathp which returns the opposite of texmathp. Then I try to use use-package with a :cond line. My goal is the following behavior:

;a returns \alpha in math mode
;a returns $\alpha$ outside of math mode.

Problem: I can't make both conditions be respected at the same time in my configuration.

Workaround: type $;a for $\alpha$ outside of math mode, but it would be nice to have a better solution.

shortened configuration

  (use-package laas
    :hook (LaTeX-mode . laas-mode)
    :config 
    (defun notmathp () (not (texmathp)))
    (aas-set-snippets 'laas-mode
      ;; set condition!
      :cond #'texmathp ; expand only while in math
      "d18o" "\\delta^{18}\\mathrm{O}"
      "d13c" "\\delta^{13}\\mathrm{C}"
   ;; set condition!
      :cond #'notmathp ; expand outside of math
      "d18o" "\$\\delta^{18}\\mathrm{O}\$"
      "d13c" "\$\\delta^{13}\\mathrm{C}\$"
      ))

Add laas-mathp to the condition of smart-fraction

It seems that laas-frac-cond doesn't require the / to be inside math. Maybe adding the condition laas-mathp is better?

Sorry, I miss the laas-mathp inside laas-object-on-left-condition, but sometimes it expands // outside math environment:

For instance, when I type // in org-mode source block to write comments, it'll be automatically expanded.

How to input \(\) or \[\] or \{\}?

Many thanks for your wonderful work, I pretty like this package.

I am wondering how can I use snippet to automatically input \(\) or \[\] or \{\}?

To be more precise, I want to use imh as the trigger to be automatically expanded to be \($0\).
I used

(aas-set-snippets 'laas-mode "imh" (lambda () (interactive) (yas-expand-snippet "\\( $0 \\)") (laas--shut-up-smartparens)

but it cannot create \(\) but only ().

The same thing happens when I want to insert \[\] and \{\}.

I think the problem may be the difficulty to insert \?

Could you please provide some advice?

I can't install it in Doom

I'm having problems trying to install those packages in Doom

I have this in my package.el

(package! latex-auto-activating-snippets :recipe (:host github :repo "tecosaur/LaTeX-auto-activating-snippets"))
(package! auto-activating-snippets :recipe (:host github :repo "ymarco/auto-activating-snippets"))

and my config.el

(use-package! auto-activating-snippets
  :hook (LaTeX-mode . auto-activating-snippets-mode)
  :hook (org-mode . auto-activating-snippets-mode)
  )

(use-package! latex-auto-activating-snippets
  :after latex ; auctex's LaTeX package
  )

But the functions aren't working, and I can't test it out in my tex files.

Thanks for the help.

Only trigger if the string is a proper word

Hello,

The snippets are activated whenever the key is seen, even in the middle of a longer word. Admittedly, there shouldn't be long words in math mode, but there may however be long commands, and they trigger just as well.

For example, if one has, say, a command \dmax, it gets inserted as \d\max.

Is it sometimes the wanted behavior?
If not, I didn't look in much detail, but it seems fairly easy to fix: the package already checks if the key is preceded by a backslash, it should just be expanded to also exclude any character with the "w" syntax.

Cheers!

option to disable some default snippets

First of all, great job on this package! I've been hoping for something like this for a while.

Currently, all of the defined snippets are being activated by default in latex-mode with these lines:

(apply #'aas-set-snippets 'latex-mode laas-basic-snippets)
(apply #'aas-set-snippets 'latex-mode laas-subscript-snippets)
(apply #'aas-set-snippets 'latex-mode laas-frac-snippet)
(apply #'aas-set-snippets 'latex-mode laas-accent-snippets)

I think it would be nice to be able to turn off this auto activation. The only way I can currently think to do this is to redefine these variables before loading the package (e.g., in :init of use-package), but then whatever I redefine them to be will still be applied. I think configuration here could be as simple as a (defvar laas-apply-all-default-snippets t) or something like that. That would give the user the option to disable activating them and then apply them selectively however (s)he wishes. But, the default behavior will be the same since most users will probably want them all applied without needing to change any settings. Let me know your thoughts.

"-<" (including "<") not recognized in LaTex-mode

I use auctex LaTeX-mode, and turn on cdlatex

My init.el is like

(use-package laas
  :ensure t
  :hook ((LaTeX-mode . laas-mode)
         (org-mode . laas-mode))
  :config
  (aas-set-snippets 'laas-mode
    :cond #'texmathp
    "-<" "\\leftarrow")

And no respond when typing "-<". Similarly, "<=" etc. failed.

Is this kind of snippet illegal?

Add support for markdown-mode

Hi!

As a naïve way to make laas to work with markdown-mode I modify the laas-mathp function (https://github.com/tecosaur/LaTeX-auto-activating-snippets/blob/master/laas.el#L60) to use laas-org-mathp to know if we are in a latex block in Markdown documents.

(defun laas-mathp ()
  "Determine whether point is within a LaTeX maths block."
  (cond
   ((derived-mode-p 'latex-mode) (texmathp))
   ((derived-mode-p 'org-mode) (laas-org-mathp))
   ((derived-mode-p 'markdown-mode) (laas-org-mathp))
   (t (message "LaTeX-auto-activated snippets does not currently support math in any of %s"
               (aas--modes-to-activate major-mode))
      nil)))

At least in my tests, everything is working fine. I can trigger all the snippets without problems.

I don't know if it's worth it to add it in into master.

Thanks.

Delete and/or modify snippets

I personally like the Idea of this package - f.e. the annoying subscripts part is really useful, but I don't like the snippets provided, as they interfere with my own.

How can I modify them and delete some?

new feature and bindings e.g. for \dot{x}

Hi,
I was just updating the package and found out that there are quite a few changes and quite a bit of further features :-)
As I used the package for quite some time now, I was pretty much used to the way of typing e.g. \dot{x} by using . after the x.
It seems this is not available anymore... is there a way to add manually just like other aas-set-snippets snippets to reproduce the old way for some selected bindings?

Thank you in advance!
Fab

How to add `\mathbb` under `'B`?

Hi!

In math, you know the importance of \mathbb to write special sets (R, N, Q, Z, etc.).

I tried to add this to my local configuration, following your code (

(defun laas-accent--rm () (interactive) (laas-wrap-previous-object (if (laas-mathp) "mathrm" "textrm")))
(defun laas-accent--it () (interactive) (laas-wrap-previous-object (if (laas-mathp) "mathit" "textit")))
(defun laas-accent--bf () (interactive) (laas-wrap-previous-object (if (laas-mathp) "mathbf" "textbf")))
(defun laas-accent--emph () (interactive) (laas-wrap-previous-object (if (laas-mathp) "mathem" "emph")))
(defun laas-accent--tt () (interactive) (laas-wrap-previous-object (if (laas-mathp) "mathtt" "texttt")))
(defun laas-accent--sf () (interactive) (laas-wrap-previous-object (if (laas-mathp) "mathsf" "textsf")))
(defvar laas-accent-snippets
`(;; work in both normal latex text and math
:cond laas-latex-accent-cond
:expansion-desc "Wrap in \\mathrm{} or \\textrm{}" "'r" laas-accent--rm
:expansion-desc "Wrap in \\mathit{} or \\textit{}" "'i" laas-accent--it
:expansion-desc "Wrap in \\mathbf{} or \\textbf{}" "'b" laas-accent--bf
:expansion-desc "Wrap in \\mathemph{} or \\textemph{}" "'e" laas-accent--emph
:expansion-desc "Wrap in \\mathtt{} or \\texttt{}" "'y" laas-accent--tt
:expansion-desc "Wrap in \\mathsf{} or \\textsf{}" "'f" laas-accent--sf
).

But, I failed miserably. This is what I have:

  (defun laas-accent--bb ()
    (interactive)
    (laas-wrap-previous-object (if (laas-mathp) "mathbb" "")))
  (aas-set-snippets 'laas-mode
    :cond #'laas-latex-accent-cond
    :expansion-desc "Wrap in \\mathbb{}"
    "B" #'laas-accent--bb))

I don't know if you could give me some pointers about what I am missing, or even better, see if this could be implemented in the package itself.

In any case, thanks for your assistance.

Best.

Disable subscript in siunitx macros

Inspired by #23, we should disable subscripts within siunitx macros such as \qty, \num, and so on.

It's currently painful to write exponents for numbers in these macros as they they currently expand to something like \num{123e_3} instead of \num{123e3}

Org-mode support

I hooked this package in org-mode in doom-emacs using this configuration:

(use-package! laas
  :hook ((LaTeX-mode . laas-mode)
         (org-mode . laas-mode))
  :config
  (aas-set-snippets 'laas-mode
                    ;;expand unconditionally
                    "mk" (lambda () (interactive) (yas-expand-snippet "\$ $0\$"))
                    "dm" (lambda () (interactive) (yas-expand-snippet "\n\\[\n$0\n\\]"))
                    )
  )

If I write a line in regular text in org-mode, the \dot{} macro triggers no mater what.

This is annoying because the combination .[SPACE] is so natural in prose.

For example if I write

$alpha$-shape point.[SPACE]

it transforms the text into

$alpha$-shape \dot{point}

The ideal case will be that the combination .[SPACE] only triggers the \dot{} macro in math mode.

Thanks.

Edit: I changed the example.

laas-mode overrides org-mode aas

I'm trying to bind a snippet to use in org-mode, while also using this package laas-mode.

(use-package aas
  :straight t)

(use-package laas
  :straight t
  :hook ((org-mode . laas-mode)
         (LaTeX-mode . laas-mode))
  :config
  (put 'aas-set-snippets 'lisp-indent-function 'defun)
  (aas-set-snippets 'laas-mode
    :cond #'laas-mathp
    "On"    "\\mathcal{O}(n)"
    "O1"    "\\mathcal{O}(1)"
    "Olog"  "\\mathcal{O}(\\log n)"
    "Olon"  "\\mathcal{O}(n \\log n)"
    "<<" nil)

  (aas-set-snippets 'org-mode
    "<<" (lambda! ()
           (yas-expand-snippet
            (concat ",#+BEGIN_SRC $1\n"
                    "$0\n"
                    ",#+END_SRC")))))

But nothing I do seems to work :?. I know laas-mode has it's own binding for << so I disabled it, but the org-mode snippet still checks laas-mathp despite me not specifiying it as a condition for aas-set-snippets.

add option to disable snippets for accents

laas-mode is great but the default behaviour that substitutes things like 'e is very disruptive in my experience, especially when writing in French. It'd be great if there was an option to disable it.
In the meanwhile, a workaround is to redefine

(defun laas-latex-accent-cond ()
  nil )

Support // for empty fraction.

The README for this package suggests binding // to an empty fraction snippet but that won't work with the current implementation because it interferes with the / snippet. I'd suggest allowing the / snippet to support // as well. Thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.