<!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>在第一个例子中,我看到$$文本漂浮在第二段旁边。然而,我希望它漂浮在第一段的旁边。如何做到这一点?
发布于 2012-02-24 05:01:47
正如我在MathJax user's forum上的回答中所解释的,解决方案是将
<br style="clear:both">在<span class="dollar">$$</span>和随后的</p>之间。这会强制该段落在下一个段落开始之前继续到浮动元素的末尾。
发布于 2012-07-19 04:21:50
另一种解决方案是使用内联MathJax命令。
示例:
方括号中的方程式将出现在新的一行中:
\\[ frac{1}{2} \\]但是如果你使用括号,那么你的等式将在同一行中:
\\( frac{3}{4} \\)https://stackoverflow.com/questions/9320311
复制相似问题