jupyter-book: Inconsistent treatment of H1 headers in LaTeX build
Describe the bug
Some H1 headers in .ipynb Markdown cells are converted to LaTeX \chapter{...} commands and some are converted to \section{...} commands. I can’t seem to tell or control why/how this happens.
To Reproduce Steps to reproduce the behavior:
- Choose a jupyter-book project. I’m using this one.
- Ensure that project has many different H1-type headers in it (using Markdown’s
#in.ipynbcells), spread over several files. - Run
jupyter-book build . --builder pdflatex. - View the generated PDF in
./_build/latex/. (In the above repo, it’s right here). - The first
#header seems to have become a chapter and all other#headers have become sections within it.
Expected behavior Each H1 header should be treated equally, each creating its own chapter.
Environment (please complete the following information):
- Python Version 3.7.3
- Output of
jupyter-book --version
Jupyter Book: 0.7.0 # but I've tried with 0.7.2dev0 also and got the same problem
MyST-NB: 0.8.1
Sphinx Book Theme: 0.0.23
MyST-Parser: 0.8.1
Jupyter-Cache: 0.2.1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 35 (30 by maintainers)
This is great! Thanks for the persistence at it.
I think you can. This PR is has handled the extension use case as well: https://github.com/executablebooks/jupyterbook-latex/pull/45
Amazing work @mmcky and everybody. Can I get rid of my repository now?
thanks @RojerGS checking your
issue810repo against PR #1167 produces the following outputpython.pdf
thanks @RojerGS for the minimal example that is a big help. I will compare it with a reference configuration for the files jupyterbook configuration.
I suspect that your issue is that you’ve got H2+ headers on your landing page. As such, Sphinx treats all other pages as subsections of those headers. See https://jupyterbook.org/customize/toc.html#how-headers-and-sections-map-onto-to-book-structure for information about how header structure maps on to book structure.
@choldgraf I haven’t run into this – but @AakashGfude is also looking into theme support for LaTeX which will assist with formatting etc. However it sounds like this issue is inconsistent which would be frustrating. @AakashGfude and I can try and replicate this issue and diagnose the issue.
Currently the PDF output is using the generic latex writer bundled with
sphinx