在 HTML 中随处获取斜体字体
Getting italic font everywhere in HTML
我从 Mathjax 网站下载了一个示例页面,并从 Github 下载了他们的包以在本地使用。此外,我想使用计算机现代字体,所以我将包含 ttf
个文件的存档解压缩到 fonts/cmu
.
这是 HTML 的修改代码:
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width">
<title>MathJax v3 with TeX input and HTML output</title>
<script>
MathJax = {
tex: {inlineMath: [['$', '$'], ['\(', '\)']]}
};
</script>
<script id="MathJax-script" async src="MathJax-master/es5/tex-chtml.js"></script>
<style type="text/css">
@font-face {
font-family: "Computer Modern";
src: url('fonts/cmu/cmunrm.ttf');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "Computer Modern";
src: url('fonts/cmu/cmunbx.ttf');
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: "Computer Modern";
src: url('fonts/cmu/cmunti.ttf');
font-weight: normal;
font-style: italic, oblique;
}
@font-face {
font-family: "Computer Modern";
src: url('fonts/cmu/cmunbi.ttf');
font-weight: bold;
font-style: italic, oblique;
}
body {
font-family: "Computer Modern", sans-serif;
margin:2em;
padding:0em;
}
p {
text-align: justify;
}
</style>
</head>
<body>
<h1>MathJax v3 beta: TeX input, HTML output test</h1>
asdasd
<p>
When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
</p>
<h2>The Lorenz Equations</h2>
<p>
\begin{align}
\dot{x} & = \sigma(y-x) \
\dot{y} & = \rho x - y - xz \
\dot{z} & = -\beta z + xy
\end{align}
</p>
<h2>In-line Mathematics</h2>
<p>Finally, while display equations look good for a page of samples, the
ability to mix math and text in a paragraph is also important. This
expression $\sqrt{3x-1}+(1+x)^2$ is an example of an inline equation. As
you see, MathJax equations can be used this way as well, without unduly
disturbing the spacing between lines.</p>
</body>
</html>
当我在 Chrome 浏览器 (Mac OS) 中打开 html 文件时,由于某种原因,所有文本都是斜体。我确定 cmunrm 是常规字体并且我没有使用 <i>
标签,所以我不明白为什么所有内容都以斜体呈现。有人可以帮忙吗?
截图如下:
经过一些研究,我发现 显然你只需要删除倾斜。
我从 Mathjax 网站下载了一个示例页面,并从 Github 下载了他们的包以在本地使用。此外,我想使用计算机现代字体,所以我将包含 ttf
个文件的存档解压缩到 fonts/cmu
.
这是 HTML 的修改代码:
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width">
<title>MathJax v3 with TeX input and HTML output</title>
<script>
MathJax = {
tex: {inlineMath: [['$', '$'], ['\(', '\)']]}
};
</script>
<script id="MathJax-script" async src="MathJax-master/es5/tex-chtml.js"></script>
<style type="text/css">
@font-face {
font-family: "Computer Modern";
src: url('fonts/cmu/cmunrm.ttf');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "Computer Modern";
src: url('fonts/cmu/cmunbx.ttf');
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: "Computer Modern";
src: url('fonts/cmu/cmunti.ttf');
font-weight: normal;
font-style: italic, oblique;
}
@font-face {
font-family: "Computer Modern";
src: url('fonts/cmu/cmunbi.ttf');
font-weight: bold;
font-style: italic, oblique;
}
body {
font-family: "Computer Modern", sans-serif;
margin:2em;
padding:0em;
}
p {
text-align: justify;
}
</style>
</head>
<body>
<h1>MathJax v3 beta: TeX input, HTML output test</h1>
asdasd
<p>
When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
</p>
<h2>The Lorenz Equations</h2>
<p>
\begin{align}
\dot{x} & = \sigma(y-x) \
\dot{y} & = \rho x - y - xz \
\dot{z} & = -\beta z + xy
\end{align}
</p>
<h2>In-line Mathematics</h2>
<p>Finally, while display equations look good for a page of samples, the
ability to mix math and text in a paragraph is also important. This
expression $\sqrt{3x-1}+(1+x)^2$ is an example of an inline equation. As
you see, MathJax equations can be used this way as well, without unduly
disturbing the spacing between lines.</p>
</body>
</html>
当我在 Chrome 浏览器 (Mac OS) 中打开 html 文件时,由于某种原因,所有文本都是斜体。我确定 cmunrm 是常规字体并且我没有使用 <i>
标签,所以我不明白为什么所有内容都以斜体呈现。有人可以帮忙吗?
截图如下:
经过一些研究,我发现