Skip to content

Improve HTML math clipping #11599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TCOTC opened this issue May 31, 2024 · 4 comments
Closed

Improve HTML math clipping #11599

TCOTC opened this issue May 31, 2024 · 4 comments
Assignees
Milestone

Comments

@TCOTC
Copy link
Contributor

TCOTC commented May 31, 2024

适配 LaTeX 公式剪藏

https://ld246.com/article/1717126687541

  1. 行内公式:使用 \( ... \) 或者 \begin{math} ... \end{math} 来插入行内公式。

    例如:\( x = 3 \)

  2. 独立公式:使用 \[ ... \] 或者 \begin{displaymath} ... \end{displaymath} 或者 \begin{equation} ... \end{equation} 来插入独立公式。

    例如:\[ y = 4 \]

@88250
Copy link
Member

88250 commented May 31, 2024

公式文本是从哪里来的,剪藏还是?

@TCOTC
Copy link
Contributor Author

TCOTC commented May 31, 2024

之前群里看到的:

01

image

e2ca656f260c5afc469eaf7197ff1fa6

02

d55392b51a95985c41be01a885baf232

比如我复制出来是这样的:

# 新的聊天

## 用户:
给我几个数学公式

## ChatGPT:
当然可以。以下是几个不同数学领域的基本公式:

1. 代数:
   - 二次方程求根公式:对于方程 \(ax^2 + bx + c = 0\),其解为 \(x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}\)。

2. 几何:
   - 圆的面积公式:\(A = \pi r^2\),其中 \(A\) 是面积,\(r\) 是半径。
   - 三角形面积公式:\(A = \frac{1}{2}bh\),其中 \(b\) 是底边长,\(h\) 是高。

3. 微积分:
   - 导数定义:\(f'(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}\)。
   - 积分定义:\(\int_a^b f(x) \, dx = \lim_{n \to \infty} \sum_{i=1}^n f(x_i^*) \Delta x\),其中 \(x_i^*\) 是区间 \([x_{i-1}, x_i]\) 中的任意一点,\(\Delta x = \frac{b-a}{n}\)。

4. 概率统计:
   - 正态分布的概率密度函数:\(f(x) = \frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{(x-\mu)^2}{2\sigma^2}}\),其中 \(\mu\) 是均值,\(\sigma\) 是标准差。
   - 二项分布的概率质量函数:\(P(X=k) = \binom{n}{k} p^k (1-p)^{n-k}\),其中 \(n\) 是试验次数,\(k\) 是成功的次数,\(p\) 是每次试验成功的概率。

5. 线性代数:
   - 矩阵乘法:如果 \(A\) 是一个 \(m \times n\) 矩阵,\(B\) 是一个 \(n \times p\) 矩阵,那么它们的乘积 \(C = AB\) 是一个 \(m \times p\) 矩阵,其中 \(C_{ij} = \sum_{k=1}^n A_{ik} B_{kj}\)。

这些公式覆盖了数学的一些基础领域,从代数到微积分,再到概率统计和线性代数。数学是一个广泛的领域,还有许多其他类型的公式和定理。

@TCOTC
Copy link
Contributor Author

TCOTC commented May 31, 2024

我这里也没有相关的网页,不知道剪藏出来的有没有问题。但至少粘贴是不能直接变为公式的

@88250
Copy link
Member

88250 commented May 31, 2024

我测了下用 chatgpt 的复制按钮复制出来的是上述形式:

image

因为语法标记符换成 \(\[ 了这个无法解析,否则会和转义符冲突。

稍后会改进对 chatgpt 网页复制粘贴公式的支持,直接复制粘贴就可以了:

image

88250 added a commit that referenced this issue May 31, 2024

Unverified

This user has not yet uploaded their public signing key.
@88250 88250 self-assigned this May 31, 2024
@88250 88250 changed the title 适配 LaTeX 公式剪藏 Improve HTML math clipping May 31, 2024
@88250 88250 added this to the 3.1.0 milestone May 31, 2024
@88250 88250 closed this as completed May 31, 2024
88250 added a commit that referenced this issue May 31, 2024
@88250 88250 modified the milestones: 3.1.0, 3.0.17 May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants