html 显示\begin{cases} Ax \leq b \\ Aeq \cdot x = beq \\ lb \leq x \leq ub \\ \end{cases} \tag{4.2}时,js文件来自本地时代码怎样写
时间: 2023-11-03 07:06:55 浏览: 56
您可以在HTML文件中使用以下代码来显示该数学公式:
```html
<!DOCTYPE html>
<html>
<head>
<title>MathJax Example</title>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</head>
<body>
<p>When rendered, the equation will look like:</p>
<div>
$$\begin{cases} Ax \leq b \\ Aeq \cdot x = beq \\ lb \leq x \leq ub \\ \end{cases} \tag{4.2}$$
</div>
</body>
</html>
```
其中,我们使用了MathJax库来渲染LaTeX数学公式。在HTML文件中引入MathJax库的方式有多种,上面的代码使用了CDN来引入。
如果您的js文件来自本地,您可以将MathJax库下载到本地并在HTML文件中引用。具体步骤如下:
1. 下载MathJax库:您可以从MathJax官网下载最新版本的MathJax库,也可以从GitHub上下载MathJax的源代码。
2. 将MathJax库解压到您的项目目录中。
3. 在HTML文件中引用MathJax库:您可以使用以下代码来引用MathJax库:
```html
<!DOCTYPE html>
<html>
<head>
<title>MathJax Example</title>
<script src="path/to/MathJax.js?config=TeX-MML-AM_CHTML"></script>
</head>
<body>
<p>When rendered, the equation will look like:</p>
<div>
$$\begin{cases} Ax \leq b \\ Aeq \cdot x = beq \\ lb \leq x \leq ub \\ \end{cases} \tag{4.2}$$
</div>
</body>
</html>
```
其中,`path/to/MathJax.js`是您下载的MathJax库的路径。在这个例子中,我们使用了MathJax的TeX-MML-AM_CHTML配置来渲染LaTeX数学公式。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)