Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modern theme and more options #106

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ jobs:
conda info
conda list

- name: pip install requirements
shell : bash -l {0}
run: |
pip install -r requirements.txt

- name: Build html
shell: bash -l {0}
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_build/
*.pyc
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Build

Install prerequisites::

sudo apt-get install python-sphinx texlive-fonts-recommended texlive-latex-extra texlive-fonts-extra dvipng
sudo apt-get install texlive-fonts-recommended texlive-latex-extra texlive-fonts-extra dvipng
pip install -r requirements.txt

To build the book, do::

Expand All @@ -29,8 +30,10 @@ Build Using Conda

Conda build::

mamba env create -f environment.yml
conda env create -f environment.yml
# mamba env create -f environment.yml # only if you have mamba installed
conda activate tprbook
pip install -r requirements.txt
make latex
tectonic _build/latex/theoretical-physics.tex

Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ dependencies:
- python=3.10
- myst-parser=1.0.0
- sphinx=6.1.3
- tectonic=0.12.0
- tectonic=0.12.0
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sphinx-copybutton
pydata-sphinx-theme
sphinx-rtd-dark-mode
sphinx-book-theme
4 changes: 4 additions & 0 deletions src/_static/css/autowrap_code.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pre {
white-space: pre-wrap !important;
word-break: break-all;
}
7 changes: 7 additions & 0 deletions src/_static/css/equation_style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.math {
text-align: left;
}

.eqno {
float: right;
}
3 changes: 3 additions & 0 deletions src/_static/css/no_width_limit.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.wy-nav-content {
max-width: none;
}
14 changes: 12 additions & 2 deletions src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ["math_dollar"]
extensions = [
"math_dollar",
"sphinx_copybutton", # code-block copy button
# "sphinx_rtd_dark_mode", # must comment this to use pydata theme
]

# Select one of the two:
if os.path.exists("use_mathjax.cfg"):
Expand Down Expand Up @@ -251,7 +255,9 @@

# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'default'
# html_theme = 'pydata_sphinx_theme'
html_theme = 'sphinx_book_theme'
# html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -281,6 +287,10 @@
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
def setup(app):
app.add_css_file("css/autowrap_code.css")
app.add_css_file("css/no_width_limit.css")
app.add_css_file("css/equation_style.css") # uncomment this for html_mathjax when using rtd theme

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Expand Down