Skip to content

Commit ed956a6

Browse files
committed
Add CSS fix to MathJax
1 parent b0d8f5e commit ed956a6

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

docs/conf.py.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ extensions = [
1111
"sphinx.ext.viewcode",
1212
]
1313

14+
# Math setting
15+
extensions += ["sphinx.ext.mathjax"]
16+
1417
# Code style
1518
pygments_style = "monokai"
1619

docs/static/css/custom.css

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,52 @@
120120
.highlight .k {
121121
color: #77D1F6 !important;
122122
}
123+
124+
/* CSS to fix Mathjax equation numbers displaying above.
125+
*
126+
* Credit to @hagenw https://github.com/readthedocs/sphinx_rtd_theme/pull/383
127+
*/
128+
div.math {
129+
position: relative;
130+
padding-right: 2.5em;
131+
}
132+
.eqno {
133+
height: 100%;
134+
position: absolute;
135+
right: 0;
136+
padding-left: 5px;
137+
padding-bottom: 5px;
138+
/* Fix for mouse over in Firefox */
139+
padding-right: 1px;
140+
}
141+
.eqno:before {
142+
/* Force vertical alignment of number */
143+
display: inline-block;
144+
height: 100%;
145+
vertical-align: middle;
146+
content: "";
147+
}
148+
.eqno .headerlink {
149+
display: none;
150+
visibility: hidden;
151+
font-size: 14px;
152+
padding-left: .3em;
153+
}
154+
.eqno:hover .headerlink {
155+
display: inline-block;
156+
visibility: hidden;
157+
margin-right: -1.05em;
158+
}
159+
.eqno .headerlink:after {
160+
visibility: visible;
161+
content: "\f0c1";
162+
font-family: FontAwesome;
163+
display: inline-block;
164+
margin-left: -.9em;
165+
}
166+
/* Make responsive */
167+
.MathJax_Display {
168+
max-width: 100%;
169+
overflow-x: auto;
170+
overflow-y: hidden;
171+
}

0 commit comments

Comments
 (0)