Skip to content

Commit ee48def

Browse files
committed
fix Mathjax equation numbering
(See readthedocs/sphinx_rtd_theme#383 and ds4dm/ecole#76)
1 parent 6d91eb1 commit ee48def

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

docs/_static/style.css

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,52 @@ table.colwidths-given {
2424
table.docutils td {
2525
white-space: unset;
2626
word-wrap: break-word;
27+
}
28+
29+
/* CSS to fix Mathjax equation numbers displaying above.
30+
*
31+
* Credit to @hagenw https://github.com/readthedocs/sphinx_rtd_theme/pull/383
32+
*/
33+
div.math {
34+
position: relative;
35+
padding-right: 2.5em;
36+
}
37+
.eqno {
38+
height: 100%;
39+
position: absolute;
40+
right: 0;
41+
padding-left: 5px;
42+
padding-bottom: 5px;
43+
/* Fix for mouse over in Firefox */
44+
padding-right: 1px;
45+
}
46+
.eqno:before {
47+
/* Force vertical alignment of number */
48+
display: inline-block;
49+
height: 100%;
50+
vertical-align: middle;
51+
content: "";
52+
}
53+
.eqno .headerlink {
54+
display: none;
55+
visibility: hidden;
56+
font-size: 14px;
57+
}
58+
.eqno:hover .headerlink {
59+
display: inline-block;
60+
visibility: hidden;
61+
}
62+
.eqno .headerlink:after {
63+
display: inline-block;
64+
visibility: visible;
65+
content: "\f0c1";
66+
font-family: FontAwesome;
67+
margin-left: -.6em;
68+
}
69+
70+
/* Make responsive */
71+
.MathJax_Display {
72+
max-width: 100%;
73+
overflow-x: auto;
74+
overflow-y: hidden;
2775
}

docs/review.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
TODO: some background statistical information/review of PDF/CDF and other terms used in `copula.md` and `fpca.md`?
44

5-
Note: I render files with the [MyST parser](https://myst-parser.readthedocs.io/en/latest/examples/wealth_dynamics_md.html) as it makes it easier to use standard LaTeX syntax. E.g. (from [their example](https://myst-parser.readthedocs.io/en/latest/examples/wealth_dynamics_md.html) -- note that [labels are not aligned correctly in the readthedocs theme](https://github.com/readthedocs/sphinx_rtd_theme/pull/383) but we can fix this later/use another theme in the case all eqs needs to be labelled):
5+
Note: I render files with the [MyST parser](https://myst-parser.readthedocs.io/en/latest/examples/wealth_dynamics_md.html) as it makes it easier to use standard LaTeX syntax.
66

77

88
## Example: Citations/Reference
@@ -21,6 +21,8 @@ dynamics.
2121

2222
The model we will study is
2323

24+
**NOTE**: eq without label
25+
2426
$$
2527
w_{t+1} = (1 + r_{t+1}) s(w_t) + y_{t+1}
2628
$$
@@ -49,6 +51,7 @@ $\mathbb R^3$.
4951

5052
(md:sav_ah)=
5153

54+
**NOTE**: eq with label
5255
```{math}
5356
---
5457
label: md:sav_ah

0 commit comments

Comments
 (0)