jupyter-book
jupyter-book copied to clipboard
Equation numbering breaks for orphan pages
Describe the bug
I have some optional pages in my book, not in the table of contents, that contain math. They are therefore orphan pages, and marked as such.
Equation numbering fails for these pages - example:
https://uob-ds.github.io/cfd2021/extra/mean_sq_deviations.html
In particular, the equation numbers are always set as ()
.
I was expecting the equation numbers to work the same way in orphan and not-orphan pages.
Reproduce the bug
git clone https://github.com/matthew-brett/jb-math-numbering
cd jb-math-numbering
make
open _build/html/math2.html
List your environment
$ jupyter-book --version
Jupyter Book : 0.13.0
External ToC : 0.2.4
MyST-Parser : 0.15.2
MyST-NB : 0.13.2
Sphinx Book Theme : 0.3.2
Jupyter-Cache : 0.4.3
NbClient : 0.5.11
$ python --version
Python 3.9.10
macOS 11.6.5
thanks @matthew-brett this is an interesting issue. I'm guessing that sphinx
when building the html
doesn't have chapter
/ section
numbers defined when parsing orphan
documents so skips writing a reference number as that document isn't part of the doctree
structure of the project.
@AakashGfude any ideas here from your work on quantecon-book-theme
when you added chapter
numbers to equations
?
@mmcky unfortunately that concerns only things in toc. Will look at the math directive properly.
@mmcky the equation number and labels, are stored in the env.toc_fignumbers
variable which we had come across in sphinx-exercise
, and sphinx-proof
extensions as well. Since these are only populated by the docs in the toc, so this issue is imminent.
@AakashGfude It isn't clear to me what the solution should be however. If a document is not contained in the toc
there is no concept of chapter. So I see two possibilities.
- Add reference material at the end of a project in an appropriately named
part
- if
env.toc_fignumbers
is not defined for a document then number the equations sequentially in that page only.