<!DOCTYPE HTML>
<html>
<head>
<title>$$ float</title>
<script
type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default">
</script>
<style type="text/css">
p {
background: lightblue;
}
span.dollar {
float: right;
background: maroon;
color: white;
}
</style>
</head>
<body>
<h1>Example 1</h1>
<p class="math">
\[
(a + b)^2 = a^2 + 2ab + b^2
\]
<span class="dollar">$$</span>
</p>
<p>Foo</p>
<h1>Example 2</h1>
<p class="math">
\(
(a + b)^2 = a^2 + 2ab + b^2
\)
<span class="dollar">$$</span>
<p>Foo</p>
</body>
</html>
在第一个示例中,我看到 $$
文本 float 在第二段旁边。但是,我希望它 float 在第一段旁边。如何做到这一点?
最佳答案
另一种解决方案是使用内联 MathJax 命令。
例子:
有了方括号,方程式将出现在一个新行中:
\\[ frac{1}{2} \\]
但是如果你使用括号那么你的等式将在同一行:
\\( frac{3}{4} \\)
关于html - 使用 MathJax\[\] 数学, float 元素随下一段而不是当前段落一起 float ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9320311/