赞
踩
对于日常使用markdown做笔记涉及数学公式来说,latex suite这个插件不要太方便。只要输入几个关键字(触发器)就能出来完整的latex公式。下面把官方文档和默认的触发器功能翻译一下。
原文地址:
https://github.com/artisticat1/obsidian-latex-suite/blob/1.4.5/DOCS.md
Snippets are formatted as follows: 代码片段格式如下:
{trigger: string, replacement: string, options: string, description?: string, priority?: number}
trigger
: The text that triggers this snippet.触发器
:触发代码的文字replacement
: The text to replace the trigger
with.替换内容
:替换触发器的文本options
: See below.选项
:看下面的解释priority
(optional): This snippet’s priority. Snippets with higher priority are run first. Can be negative. Defaults to 0.优先级
:可选。代码片段优先级。高优先级的代码片段先运行。可以是负数,默认是0.description
(optional): A description for this snippet.描述
:可选。代码片段的注释。m
: Math mode. Only run this snippet inside mathm
:数学模式,这个片段只在数学公式内有效。($$代码段)t
: Text mode. Only run this snippet outside matht
:文本模式。这个片段只在数学公式外有效。A
: Auto. Expand this snippet as soon as the trigger is typed. If omitted, the Tab key must be pressed to expand the snippetA
:自动。一旦输入触发器文字,就自动替换为代码段。如果没有此参数,必须要按下Tab键才会触发替换。r
: Regex. The trigger
will be treated as a regular expressionr
:正则表达式。触发器会被当做公式表达式。w
: Word boundary. Only run this snippet when the trigger is preceded by (and followed by) a word delimiter, such as .
, ,
, or -
.w
:符号边界。这个代码段只有被指定的字符如,
,.
,-
前后包围时才有效。$X
, where X is a number starting from 0.${X:text}
, where text
is the text that will be selected by the cursor on moving to this tabstop.
{trigger: "//", replacement: "\\frac{$0}{$1}$2", options: "mA"}
输入'//' ,替换为除法公式。
{trigger: "dint", replacement: "\\int_{${0:0}}^{${1:\\infty}} $2 d${3:x}", options: "mA"}
{trigger: "outp", replacement: "\\ket{${0:\\psi}} \\bra{${0:\\psi}} $1", options: "mA"}
r
option to create a regex snippet.r
选项创建公式代码段trigger
, surround an expression with brackets ()
to create a capturing group.replacement
string, strings of the form [[X]]
will be replaced by matches in increasing order of X, starting from 0.replacement
字符串中,格式为[[X]]
的字符串将会被触发器输入组中对应顺序的字符替代。❗ Warnings警告
- Some characters, such as
\
,+
, and.
, are special characters in regex. If you want to use these literally, remember to escape them by inserting two backslashes (\\
) before them!
某些字符如\
,+
, and.
,在公式中是特殊字符。如果要使用这些字符,需要在前面加上转义符\\
The snippet代码段
{trigger: "([A-Za-z])(\\d)", replacement: "[[0]]_{[[1]]}", options: "rA"}
详细解释:
触发器中,第一个括号内表明可以输入任何字母,第二个括号表明输入数字。
替换内容表示用第一个字母加_
加第二个数字作为替换文本。
这个触发器表示将形如x2
的输入变为x_{2}
,也就是 x 2 x_{2} x2
The following variables are available for use in a trigger
or replacement
:
在触发器和替换内容中可以使用以下变量
${VISUAL}
: Can be inserted in a replacement
. When the snippet is expanded, "
V
I
S
U
A
L
"
i
s
r
e
p
l
a
c
e
d
w
i
t
h
t
h
e
c
u
r
r
e
n
t
s
e
l
e
c
t
i
o
n
.
‘
{VISUAL}" is replaced with the current selection. `
VISUAL"isreplacedwiththecurrentselection.‘{VISUAL} :可以插入替换内容,当代码段展开时,
${VISUAL}` 被替换为当前选择内容。title:进入数学模式
{trigger: "mk", replacement:"$$0$", options: "tA"}
文本模式下输入"mk"进入单行数学模式
{trigger: "dm", replacement: "\$\$\n$0\n\$\$", options: "tAw"},
文本模式下输入"dm"进入多行数学模式
{trigger: "beg", replacement: "\\begin{$0}\n$1\n\\end{$0}", options: "mA"}
文本模式下输入"beg"进入多行数学模式并加入begin和end块
title:罗马字符
{trigger: "@a", replacement: "\\alpha", options: "mA"},
{trigger: "@A", replacement: "\\alpha", options: "mA"},
{trigger: "@b", replacement: "\\beta", options: "mA"},
{trigger: "@B", replacement: "\\beta", options: "mA"},
{trigger: "@c", replacement: "\\chi", options: "mA"},
{trigger: "@C", replacement: "\\chi", options: "mA"},
{trigger: "@g", replacement: "\\gamma", options: "mA"},
{trigger: "@G", replacement: "\\Gamma", options: "mA"},
{trigger: "@d", replacement: "\\delta", options: "mA"},
{trigger: "@D", replacement: "\\Delta", options: "mA"},
{trigger: "@e", replacement: "\\epsilon", options: "mA"},
{trigger: "@E", replacement: "\\epsilon", options: "mA"},
下略
title:罗马字符后面加其他字符
{trigger: "\\\\(${GREEK}|${SYMBOL})([A-Za-z])", replacement: "\\[[0]] [[1]]", options: "rmA"},
默认情况下罗马字符后面不加空格就加其他字符会出错,以上代码段自动在罗马字符后加空格。
{trigger: "\\\\(${GREEK}|${SYMBOL}) sr", replacement: "\\[[0]]^{2}", options: "rmA"},
罗马字符的平方
{trigger: "\\\\(${GREEK}|${SYMBOL}) cb", replacement: "\\[[0]]^{3}", options: "rmA"},
罗马字符的立方
{trigger: "\\\\(${GREEK}|${SYMBOL}) rd", replacement: "\\[[0]]^{$0}$1", options: "rmA"},
罗马字符后自动加上n次方括号并把光标移动到括号内
{trigger: "\\\\(${GREEK}|${SYMBOL}) hat", replacement: "\\hat{\\[[0]]}", options: "rmA"},
罗马字符上面加戴帽符号
{trigger: "\\\\(${GREEK}|${SYMBOL}) dot", replacement: "\\dot{\\[[0]]}", options: "rmA"},
罗马字符上面加点符号
{trigger: "\\\\(${GREEK}|${SYMBOL}) bar", replacement: "\\bar{\\[[0]]}", options: "rmA"},
罗马字符上面加平均符号
title:操作符 {trigger: "te", replacement: "\\text{$0}", options: "m"}, 加入文本 {trigger: "sr", replacement: "^{2}", options: "mA"}, 平方符号 {trigger: "cb", replacement: "^{3}", options: "mA"}, 立方符号 {trigger: "rd", replacement: "^{$0}$1", options: "mA"}, n次方(上标) {trigger: "_", replacement: "_{$0}$1", options: "mA"}, 下标 {trigger: "sts", replacement: "_\\text{$0}", options: "rmA"}, 另一个下标 {trigger: "sq", replacement: "\\sqrt{ $0 }$1", options: "mA"}, 开方 {trigger: "//", replacement: "\\frac{$0}{$1}$2", options: "mA"}, 除法 {trigger: "ee", replacement: "e^{ $0 }$1", options: "mA"}, 指数函数 {trigger: "([A-Za-z])(\\d)", replacement: "[[0]]_{[[1]]}", options: "rmA", description: "Auto letter subscript", priority: -1}, 自动加下标 {trigger: "\\\\mathbf{([A-Za-z])}(\\d)", replacement: "\\mathbf{[[0]]}_{[[1]]}", options: "rmA"}, {trigger: "([A-Za-z])_(\\d\\d)", replacement: "[[0]]_{[[1]]}", options: "rmA"}, {trigger: "conj", replacement: "^{*}", options: "mA"}, {trigger: "bar", replacement: "\\bar{$0}", options: "mA"}, {trigger: "hat", replacement: "\\hat{$0}", options: "mA"}, {trigger: "dot", replacement: "\\dot{$0}", options: "mA"}, {trigger: "([^\\\\])(arcsin|arccos|arctan|arccot|arccsc|arcsec|sin|cos|tan|cot|csc)", replacement: "[[0]]\\[[1]]", options: "rmA"}, {trigger: "\\\\(arcsin|arccos|arctan|arccot|arccsc|arcsec|sin|cos|tan|cot|csc)([A-Za-gi-z])", replacement: "\\[[0]] [[1]]", options: "rmA"}, // Insert space after trig funcs. Skips letter "h" to allow sinh, cosh, etc. 三角函数后面自动加空格 {trigger: "\\\\(arcsinh|arccosh|arctanh|arccoth|arcsch|arcsech|sinh|cosh|tanh|coth|csch)([A-Za-z])", replacement: "\\[[0]] [[1]]", options: "rmA"}, // Insert space after trig funcs 同上
title:视觉效果。注意要选中一个字符串然后输入触发器命令。
{trigger: "U", replacement: "\\underbrace{ ${VISUAL} }_{ $0 }", options: "mA"},
下大括号
{trigger: "B", replacement: "\\underset{ $0 }{ ${VISUAL} }", options: "mA"},
上下结构
{trigger: "C", replacement: "\\cancel{ ${VISUAL} }", options: "mA"},
斜线
{trigger: "K", replacement: "\\cancelto{ $0 }{ ${VISUAL} }", options: "mA"},
斜线带指数
{trigger: "S", replacement: "\\sqrt{ ${VISUAL} }", options: "mA"},
开方
title:数学符号 {trigger: "ooo", replacement: "\\infty", options: "mA"}, {trigger: "sum", replacement: "\\sum", options: "mA"}, {trigger: "prod", replacement: "\\prod", options: "mA"}, {trigger: "lim", replacement: "\\lim_{ ${0:n} \\to ${1:\\infty} } $2", options: "mA"}, {trigger: "pm", replacement: "\\pm", options: "m"}, {trigger: "...", replacement: "\\dots", options: "mA"}, {trigger: "<->", replacement: "\\leftrightarrow ", options: "mA"}, {trigger: "->", replacement: "\\to", options: "mA"}, {trigger: "!>", replacement: "\\mapsto", options: "mA"}, {trigger: "invs", replacement: "^{-1}", options: "mA"}, {trigger: "\\\\\\", replacement: "\\setminus", options: "mA"}, {trigger: "||", replacement: "\\mid", options: "mA"}, {trigger: "and", replacement: "\\cap", options: "mA"}, {trigger: "orr", replacement: "\\cup", options: "mA"}, {trigger: "inn", replacement: "\\in", options: "mA"}, {trigger: "\\subset eq", replacement: "\\subseteq", options: "mA"}, {trigger: "set", replacement: "\\{ $0 \\}$1", options: "mA"}, {trigger: "=>", replacement: "\\implies", options: "mA"}, {trigger: "=<", replacement: "\\impliedby", options: "mA"}, {trigger: "iff", replacement: "\\iff", options: "mA"}, {trigger: "e\\xi sts", replacement: "\\exists", options: "mA", priority: 1}, {trigger: "===", replacement: "\\equiv", options: "mA"}, {trigger: "Sq", replacement: "\\square", options: "mA"}, {trigger: "!=", replacement: "\\neq", options: "mA"}, {trigger: ">=", replacement: "\\geq", options: "mA"}, {trigger: "<=", replacement: "\\leq", options: "mA"}, {trigger: ">>", replacement: "\\gg", options: "mA"}, {trigger: "<<", replacement: "\\ll", options: "mA"}, {trigger: "~~", replacement: "\\sim", options: "mA"}, {trigger: "\\sim ~", replacement: "\\approx", options: "mA"}, {trigger: "prop", replacement: "\\propto", options: "mA"}, {trigger: "nabl", replacement: "\\nabla", options: "mA"}, {trigger: "del", replacement: "\\nabla", options: "mA"}, {trigger: "xx", replacement: "\\times", options: "mA"}, {trigger: "**", replacement: "\\cdot", options: "mA"}, {trigger: "pal", replacement: "\\parallel", options: "mA"}, {trigger: "xnn", replacement: "x_{n}", options: "mA"}, {trigger: "xii", replacement: "x_{i}", options: "mA"}, {trigger: "xjj", replacement: "x_{j}", options: "mA"}, {trigger: "xp1", replacement: "x_{n+1}", options: "mA"}, {trigger: "ynn", replacement: "y_{n}", options: "mA"}, {trigger: "yii", replacement: "y_{i}", options: "mA"}, {trigger: "yjj", replacement: "y_{j}", options: "mA"}, {trigger: "mcal", replacement: "\\mathcal{$0}$1", options: "mA"}, {trigger: "ell", replacement: "\\ell", options: "mA"}, {trigger: "lll", replacement: "\\ell", options: "mA"}, {trigger: "LL", replacement: "\\mathcal{L}", options: "mA"}, {trigger: "HH", replacement: "\\mathcal{H}", options: "mA"}, {trigger: "CC", replacement: "\\mathbb{C}", options: "mA"}, {trigger: "RR", replacement: "\\mathbb{R}", options: "mA"}, {trigger: "ZZ", replacement: "\\mathbb{Z}", options: "mA"}, {trigger: "NN", replacement: "\\mathbb{N}", options: "mA"}, {trigger: "II", replacement: "\\mathbb{1}", options: "mA"}, {trigger: "\\mathbb{1}I", replacement: "\\hat{\\mathbb{1}}", options: "mA"}, {trigger: "AA", replacement: "\\mathcal{A}", options: "mA"}, {trigger: "BB", replacement: "\\mathbf{B}", options: "mA"}, {trigger: "EE", replacement: "\\mathbf{E}", options: "mA"},
title:导数 // Derivatives {trigger: "par", replacement: "\\frac{ \\partial ${0:y} }{ \\partial ${1:x} } $2", options: "m"}, 导数,注意要用tab展开 {trigger: "pa2", replacement: "\\frac{ \\partial^{2} ${0:y} }{ \\partial ${1:x}^{2} } $2", options: "mA"}, 二阶导数 {trigger: "pa3", replacement: "\\frac{ \\partial^{3} ${0:y} }{ \\partial ${1:x}^{3} } $2", options: "mA"}, 三阶导数 {trigger: "pa([A-Za-z])([A-Za-z])", replacement: "\\frac{ \\partial [[0]] }{ \\partial [[1]] } ", options: "rm"}, 导数指定函数名 {trigger: "pa([A-Za-z])([A-Za-z])([A-Za-z])", replacement: "\\frac{ \\partial^{2} [[0]] }{ \\partial [[1]] \\partial [[2]] } ", options: "rm"}, 多函数导数 {trigger: "pa([A-Za-z])([A-Za-z])2", replacement: "\\frac{ \\partial^{2} [[0]] }{ \\partial [[1]]^{2} } ", options: "rmA"}, 二阶导数 {trigger: "de([A-Za-z])([A-Za-z])", replacement: "\\frac{ d[[0]] }{ d[[1]] } ", options: "rm"}, 导数除法表示dy/dx {trigger: "de([A-Za-z])([A-Za-z])2", replacement: "\\frac{ d^{2}[[0]] }{ d[[1]]^{2} } ", options: "rmA"}, {trigger: "ddt", replacement: "\\frac{d}{dt} ", options: 导数除法表示d/dt
title:积分
{trigger: "oinf", replacement: "\\int_{0}^{\\infty} $0 \\, d${1:x} $2", options: "mA"},
0到正无穷积分
{trigger: "infi", replacement: "\\int_{-\\infty}^{\\infty} $0 \\, d${1:x} $2", options: "mA"},
正负无穷积分
{trigger: "dint", replacement: "\\int_{${0:0}}^{${1:\\infty}} $2 \\, d${3:x} $4", options: "mA"},
指定下限积分
{trigger: "oint", replacement: "\\oint", options: "mA"},
{trigger: "iiint", replacement: "\\iiint", options: "mA"},
{trigger: "iint", replacement: "\\iint", options: "mA"},
{trigger: "int", replacement: "\\int $0 \\, d${1:x} $2", options: "mA"},
title:环境(矩阵、排列等)
// Environments
{trigger: "pmat", replacement: "\\begin{pmatrix}\n$0\n\\end{pmatrix}", options: "mA"},
{trigger: "bmat", replacement: "\\begin{bmatrix}\n$0\n\\end{bmatrix}", options: "mA"},
{trigger: "Bmat", replacement: "\\begin{Bmatrix}\n$0\n\\end{Bmatrix}", options: "mA"},
{trigger: "vmat", replacement: "\\begin{vmatrix}\n$0\n\\end{vmatrix}", options: "mA"},
{trigger: "Vmat", replacement: "\\begin{Vmatrix}\n$0\n\\end{Vmatrix}", options: "mA"},
{trigger: "case", replacement: "\\begin{cases}\n$0\n\\end{cases}", options: "mA"},
{trigger: "align", replacement: "\\begin{align}\n$0\n\\end{align}", options: "mA"},
{trigger: "array", replacement: "\\begin{array}\n$0\n\\end{array}", options: "mA"},
{trigger: "matrix", replacement: "\\begin{matrix}\n$0\n\\end{matrix}", options: "mA"},
title:括号
{trigger: "lr(", replacement: "\\left( $0 \\right) $1", options: "mA"},
{trigger: "lr|", replacement: "\\left| $0 \\right| $1", options: "mA"},
{trigger: "lr{", replacement: "\\left\\{ $0 \\right\\} $1", options: "mA"},
{trigger: "lr[", replacement: "\\left[ $0 \\right] $1", options: "mA"},
{trigger: "lra", replacement: "\\left< $0 \\right> $1", options: "mA"},
{trigger: "avg", replacement: "\\langle $0 \\rangle $1", options: "mA"},
{trigger: "(", replacement: "(${VISUAL})", options: "mA"},
{trigger: "[", replacement: "[${VISUAL}]", options: "mA"},
{trigger: "{", replacement: "{${VISUAL}}", options: "mA"},
{trigger: "(", replacement: "($0)$1", options: "mA"},
{trigger: "{", replacement: "{$0}$1", options: "mA"},
{trigger: "[", replacement: "[$0]$1", options: "mA"},
{trigger: "mod", replacement: "|$0|$1", options: "mA"},
{trigger: "norm", replacement: "\\|$0\\|$1", options: "mA", priority: 1},
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。