Skip to content

latex格式的数据解析不正确,部分数学公式展示不符合要求,没有按照正常的数学公式要求展示 #685

@zwj123-work

Description

@zwj123-work

使用环境

小程序开发者工具,基础库版本3.13.0

问题描述

1、使用mp-html的latex扩展编译数学公式时除法、积分∫符号的上下限值、平方显示为x2立方显示为x3而非x²x³、图中公式竖线和他右侧上下两值的显示格式不正确
Image
2、以下是示例的截图:
Image
Image
Image

复现方式

1、以下是复现文本内容

(1) 求 \(f(0)\)、\(f'(0)\)、\(f''(0)\) 的值 ↵首先,分母 \(x^3 \to 0\)(\(x \to 0\)),极限存在为1,故分子 \(f(x)-\sin x \to 0\),即 \(f(0)=\sin0=0\)。 ↵↵由洛必达法则,对分子分母求一阶导: ↵\(\lim_{x \to 0} \frac{f'(x)-\cos x}{3x^2}=1\),分母 \(3x^2 \to 0\),故分子 \(f'(x)-\cos x \to 0\),即 \(f'(0)=\cos0=1\)。 ↵↵再求二阶导: ↵\(\lim_{x \to 0} \frac{f''(x)+\sin x}{6x}=1\),分母 \(6x \to 0\),分子 \(f''(x)+\sin x \to 0\),即 \(f''(0)=-\sin0=0\)。 ↵↵再对分子分母求导(因 \(f''(x)\) 连续): ↵\(\lim_{x \to 0} \frac{f'''(x)+\cos x}{6}=1\),故 \(f'''(0)+\cos0=6\),得 \(f'''(0)=5\)。但题目仅需前二阶导数,故 \(f(0)=0\),\(f'(0)=1\),\(f''(0)=0\)。 ↵↵↵### (2) 求定积分 \(\int_0^\pi f(x)\cos x dx\) ↵用分部积分:设 \(u=f(x)\),\(dv=\cos x dx\),则 \(du=f'(x)dx\),\(v=\sin x\),得 ↵\(\int_0^\pi f(x)\cos x dx = f(x)\sin x\bigg|_0^\pi - \int_0^\pi f'(x)\sin x dx = 0 - \int_0^\pi f'(x)\sin x dx\)。 ↵↵再分部积分:设 \(u=f'(x)\),\(dv=\sin x dx\),则 \(du=f''(x)dx\),\(v=-\cos x\),得 ↵\(-\left[ -f'(x)\cos x\bigg|_0^\pi + \int_0^\pi f''(x)\cos x dx \right] = f'(x)\cos x\bigg|_0^\pi - \int_0^\pi f''(x)\cos x dx\)。 ↵↵代入上下限:\(f'(\pi)\cos\pi - f'(0)\cos0 = -f'(\pi)-1\)。但由泰勒展开,\(f(x)=\sin x + x^3 + o(x^3)\),故 \(f'(x)=\cos x + 3x^2 + o(x^2)\),\(f''(x)=-\sin x + 6x + o(x)\),\(\int_0^\pi f''(x)\cos x dx = \int_0^\pi (-\sin x + 6x)\cos x dx + o(1)\),其中 \(\int_0^\pi -\sin x \cos x dx=0\),\(\int_0^\pi 6x\cos x dx=6(x\sin x + \cos x)\bigg|0^\pi=6(-1-1)=-12\)。结合前式得结果为 \(-12\)(详细展开验证后,最终积分值为 \(-12\))。 ↵↵↵### (3) 判断级数 \(\sum{n=1}^\infty \frac{f(\frac{1}{n})}{\ln(1+n)}\) 的敛散性 ↵由泰勒展开,\(f(x)=\sin x + x^3 + o(x^3)\approx x - \frac{x^3}{6} + x^3 = x + \frac{5x^3}{6} + o(x^3)\),当 \(n \to \infty\) 时,\(f(\frac{1}{n})\approx \frac{1}{n} + \frac{5}{6n^3}\),\(\ln(1+n)\approx \ln n\),故通项 \(a_n\approx \frac{1}{n\ln n}\)。 ↵↵由积分判别法,\(\int_2^\infty \frac{1}{x\ln x}dx = \ln\ln x\bigg|_2^\infty \to \infty\),故级数发散。 ↵↵↵是否需要进一步解释泰勒展开在判断级数敛散性中的应用?

2、以下是使用的mp-html文件截图
Image
Image
3、以下是使用的mp-html中latex扩展的文件夹中的文件,除了index.js中做了部分修改其他均为2.5.1latex的原文件
index.js
build.js
katex.css
katex.min.js
README.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions