答案1
也许您可以使用 AUCTeX 提供的字体说明符功能:当您处于数学模式并按下 时C-c C-f C-a,它会插入\mathcal{@}
,如果您标记一部分文本,例如C
,并按下按键,它会插入\mathcal{C@}
(捐赠光标位置)。通过点击 ,@
您可以获得相同的结果。按键存储在 中,预定义如下:\mathbb
C-c C-f C-bLaTeX-font-list
(defcustom LaTeX-font-list
'((?\C-a "" "" "\\mathcal{" "}")
(?\C-b "\\textbf{" "}" "\\mathbf{" "}")
(?\C-c "\\textsc{" "}")
(?\C-e "\\emph{" "}")
(?\C-f "\\textsf{" "}" "\\mathsf{" "}")
(?\C-i "\\textit{" "}" "\\mathit{" "}")
(?\C-l "\\textulc{" "}")
(?\C-m "\\textmd{" "}")
(?\C-n "\\textnormal{" "}" "\\mathnormal{" "}")
(?\C-r "\\textrm{" "}" "\\mathrm{" "}")
(?\C-s "\\textsl{" "}" "\\mathbb{" "}")
(?\C-t "\\texttt{" "}" "\\mathtt{" "}")
(?\C-u "\\textup{" "}")
(?\C-w "\\textsw{" "}")
(?\C-d "" "" t))
"Font commands used with LaTeX2e. See `TeX-font-list'.")
答案2
结果比我想象的要简单。要获得所需的效果\mathcal
,只需将以下内容添加到.emacs
(defun my-LaTeX-math-cal (char dollar)
(interactive "*c\nP")
(if (texmathp)
(LaTeX-math-cal char dollar)
(LaTeX-math-cal char t))
)
然后绑定到任意快捷方式。对和 也my-LaTeX-math-cal
可以执行类似的操作。\mathbb
\mathfrak