【发布时间】:2020-11-27 22:49:23
【问题描述】:
我从 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> 标签,所以我不明白为什么所有内容都以斜体呈现。有人可以帮忙吗?
【问题讨论】:
-
能把截图给我们看看就好了。
-
如果你只有一个字体文件,你可以尝试使用@font-face 一次。也许这会有所帮助。
-
@m4n0:完成!编辑了问题。
-
@MaciejBłędkowski:但是字体的常规版本和斜体版本在完全不同的文件中,并且应用于常规字体的 标签并没有给出预期的结果——它与斜体版
-
好像你在声明字体样式:斜体、斜体;