2017-08-06 31 views
0

當使用html背景和字體顏色時,以下html文件在顯示模式下不顯示LaTex表達式(分數a/b)。另外,在內聯模式下,使用背景和字體顏色時,分母會將較低的邊緣切割一點(如下圖所示)。感謝您爲我們提供MathJax,因爲它在我們工作的許多領域對我們有很大的幫助。帶有html背景和字體顏色問題的MathJax

HTML文件

<html> 
<head> 
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML"> 
</script> 
</head> 
<body> 
A \(\frac{a}{b}\) fraction in inline mode 
<br/> 
A\[\frac{a}{b}\] fraction in display mode 
<br/> 
A <span style='color:white;background:black'>\(\frac{a}{b}\)</span> fraction in inline mode with black background and white font 
<br/> 
A <span style='color:white;background:black'>\[\frac{a}{b}\]</span> fraction in display mode with black background and white font. This one is not displaying fraction. 

</body> 
</html> 

同時顯示在IE 11和Chrome

enter image description here

回答

0

你可以通過改變<span style='color:white;background:black'><span class='inverted'>並添加這個CSS代碼來解決它你樣式表

.inverted .math { 
    color: white; 
    background-color: black; 
} 

您可能還會發現CSS Style Objects有用。

編輯:

一種方法來添加這個CSS是更改代碼的<head>標籤內是這樣的:

<head> 
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML"></script> 
    <style type="text/css"> 
    .inverted .math { 
     color: white; 
     background-color: black; 
    } 
    </style> 
</head> 

我也強烈建議你學習CSS的基礎知識(至少),w3schools tutorials可能真的很有幫助。

+0

您的建議工作(謝謝)。我在上面的Html文件中的''標籤中添加了你的css代碼,裏面有''。 – nam

+0

@nam還有其他方法可以做到這一點,並且可能會遇到許多CSS問題,爲避免浪費時間,請考慮閱讀教程。祝你好運。 – alex