certik / theoretical-physics

Source code of the Theoretical Physics Reference online book
https://theoretical-physics.com
MIT License
222 stars 48 forks source link

Modern theme and more options #105

Open m3lab-zzl opened 11 months ago

m3lab-zzl commented 11 months ago

Just a suggestion, ReadTheDocs theme and Pydata theme both look nice and have many advanced functions, such as dark mode, sticky TOC, and easily navigation. They are being used by many popular scientific projects like numpy, scipy, pandas, ...

If you guys like, I will create a PR then, with a "dark-mode" toggle button, sticky TOC, wider page, and quickly copy code-block function enabled.

certik commented 11 months ago

@m3lab-zzl that would be awesome, thank you. Go ahead!

m3lab-zzl commented 11 months ago

Right, I am working on this (the toolchain got me some trouble due to bad internet connection). The PR will come soon.

m3lab-zzl commented 11 months ago

Preview the mathjax version (equations are rendered by mathjax on the fly)

image

image

image

image

image

The new 4 options all have a user-friendly sidebar that makes the navigation easier, and a search box for quickly jumping to any interested part. The page width is no longer fixed at some weird width that would leave the right part blank. One final change is the code-block copy button and autowrap:

image

Pydata theme has a Back to top button, if you like this theme, we may need to change the project structure, as the top navigation bar can only display short titles.

As you mentioned before, Mathjax rendered equations look nicer (also visible in dark mode), and it took much less time to build, but the source code needs some modification to correctly generate the desired output. If you insist the dvisvg solution, equations will be invisible in dark mode.

See PR #106 for code change

m3lab-zzl commented 11 months ago

sphinx_book_theme suits better than pydata theme, no need to change project structure because the chapters are placed in the left sidebar. not at the top for pydata theme:

image

Here lists more themes:

https://sphinx-themes.org/