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

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

Open maikol-solis opened this issue 2 years ago • 2 comments
trafficstars

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 (https://github.com/tecosaur/LaTeX-auto-activating-snippets/blob/a00f0aba237b85b3e5fd60cf84de5759d1bf5d48/laas.el#L421-L435).

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.

maikol-solis avatar Oct 11 '23 20:10 maikol-solis

I could make some progress defining this snippet

(aas-set-snippets 'laas-mode
    :cond #'laas-object-on-left-condition
    :expansion-desc "Wrap in \\mathbb{}"
    "bb" #'laas-accent--bb)

So you need to type $Rbb$ to turn it into $\mathbb{R}$.

It isn't like the others, but it works well enough.

maikol-solis avatar Oct 12 '23 12:10 maikol-solis