orgmode中yasnippet条件temathp数学环境能被识别但无法展开的问题

在尝试使用yasnippet的过程中 在condition中设置(texmathp), 在数学环境中(比如$$中)yasnippet无法expand,直接跳转到下一行 已尝试的方案

  1. 在数学环境中M-:(texmathp) 返回t 2.重装AUCTex,yasnippet等package 3.尝试设置auto-expand 在其他环境中都可以做到auto-expand,但在数学环境还是无法auto-expand, 已尝试的condition (and (texmathp) 'auto); 'auto;(or (texmathp) 'auto); (texmathp) 有没有兄弟遇到过这个情况 :frowning:

随后安装并测试aas和laas,还是一样的问题 在正常环境下可以自动展开 在需要texmathp的数学环境里无法正常展开 M-:(texmathp)一样返回的是t 要晕厥了

最好,贴上完整的 snippet。 估计是什么条件,引起的。

我平常用 aas,是没有问题的,我是这样设置的:

(aas-set-snippets 'org-mode
      :cond #'texmathp
      "ff" '(yas "\\frac{$1}{$2}$0")
      "sp" '(yas "^{$1}$0")
      "sb" '(yas "_{$1}$0")
      :cond #'(lambda () (and (not (texmathp))
  			    (looking-back "^" nil)))
      "dm" '(yas "\\[$1\\]$0")
)
# -*- mode: snippet -*-
# name: frac
# key: //
# condition: 'auto
# --
\\frac{$1}{$2}$0

emmm就是最普通的frac, 然后各种条件都试过了 always texmathp auto 那些全都试过了,在$$里就是无法展开,不知道是不是doom引起的问题

thx for ur reply! btw想问问你用的是什么版本的emacs或者doom, 我现在有点怀疑是doom哪里设置的问题

是不是空格的问题?

这个无法展开:

 $//$

下面的可以:

 $ // $

刚才测试了一下, 在condition: (texmathp) 的情况下下面的情况也是无法展开, 另外下面的情况M-:(texmathp)也是返回的nil thx for ur reply!

在我把completion改成company之后问题aas终于可以用了!虽然yas还是用不了 thx!

# -*- mode: snippet -*-
# name: Limit
# key: lim
# condition: (org-inside-LaTeX-fragment-p)
# --
\\lim_{$1 \to $2} $0

我之前问 grok3 问出来过