使用自定义标签 PHP 正则表达式包装 Latex 方程式
Wrap Latex Equation using custom tag PHP regex
我只想使用任何 html 标签包装数学乳胶方程。字符串就像
y = x2 or \(x = \sqrt{y}\) . For all \(y \geq 0\), x is defined. Thus, y is set of all non-negative and real number. Hence, range is \(y \geq 0\) or [0, ∞).
我想要这样的输出
y = x2 or <math>\(x = \sqrt{y}\)</math> . For all <math>\(y \geq 0\)</math>, x is defined. Thus, y is set of all non-negative and real number. Hence, range is <math>\(y \geq 0\)</math> or [0, ∞).
等式的模式如下所示:
((\\()((?!(\\()|(\\))).)*(\\)))
前缀(\\()
和后缀(\\))
是对等式开始和结束的简单检查。
中间部分((?!(\\()|(\\))).)*
算任意一个字符(.
)(\n除外)除非通过向前看“(?! ...)
”前面的两个字符是[=17中的一个=] 或 \)
.
整个方程组都在(...)
中,所以可以称为组1或</code>。所以应该替换为:</p>
<pre><code><math></math>
我只想使用任何 html 标签包装数学乳胶方程。字符串就像
y = x2 or \(x = \sqrt{y}\) . For all \(y \geq 0\), x is defined. Thus, y is set of all non-negative and real number. Hence, range is \(y \geq 0\) or [0, ∞).
我想要这样的输出
y = x2 or <math>\(x = \sqrt{y}\)</math> . For all <math>\(y \geq 0\)</math>, x is defined. Thus, y is set of all non-negative and real number. Hence, range is <math>\(y \geq 0\)</math> or [0, ∞).
等式的模式如下所示:
((\\()((?!(\\()|(\\))).)*(\\)))
前缀(\\()
和后缀(\\))
是对等式开始和结束的简单检查。
中间部分((?!(\\()|(\\))).)*
算任意一个字符(.
)(\n除外)除非通过向前看“(?! ...)
”前面的两个字符是[=17中的一个=] 或 \)
.
整个方程组都在(...)
中,所以可以称为组1或</code>。所以应该替换为:</p>
<pre><code><math></math>