Forgot password
 Register account
View 222|Reply 3

如何在 SVG 图表中包含 MathJax SVG

[Copy link]

3211

Threads

7832

Posts

52

Reputation

Show all posts

hbghlyj posted 2024-9-10 03:56 |Read mode
除了 <foreignObject> 之外,还有一种方法:用 <g transform="translate(x,y)"> 包裹

这种方法不需要指定 MathJax 公式的高度和宽度,比 <foreignObject> 简便

3211

Threads

7832

Posts

52

Reputation

Show all posts

original poster hbghlyj posted 2024-9-10 03:59

在 SVG 图表中包含 MathJax

在 SVG 图表中包含 MathJax $A(0,0),B(u_1,0),C(u_2,x_1),D(x_2,x_1)$.
方法如下:

3211

Threads

7832

Posts

52

Reputation

Show all posts

original poster hbghlyj posted 2024-9-10 04:06
除了包在 <g transform="translate(x,y)"> 中,我们还可以将 MathJax SVG 的属性 x 和 y 设置为所需的对应值,因此不需要包 <g> 元素


3211

Threads

7832

Posts

52

Reputation

Show all posts

original poster hbghlyj posted 2024-9-10 04:22
另一种方法是使用 CSS 绝对定位。latex2js.com/ 使用了这种方法。这需要包一个 <div> 元素
$x(t)$
$f(t)$
$g(t)$
$y(t)$
$h(t)$
$X_k = \frac{1}{p} \sum \limits_{n=\langle p\rangle}x(n)e^{-ik\omega_0n}$

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-7-20 05:41 GMT+8

Powered by Discuz!

Processed in 0.016451 seconds, 41 queries