Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 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
11 changes: 8 additions & 3 deletions .github/workflows/ci_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ jobs:
sphinx-design
sphinx-gallery
sphinx_rtd_theme<3.0
cairosvg
sphinxcontrib-svg2pdfconverter
tectonic

# Download cached remote files (artifacts) from GitHub
- name: Download remote data from GitHub
Expand All @@ -135,9 +138,11 @@ jobs:
python -m build --sdist
python -m pip install dist/*

# Build the documentation
- name: Build the documentation
run: make -C doc clean all
- name: Build the HTML documentation
run: make -C doc clean html

- name: Build the PDF documentation
run: make -C doc pdf

- name: Checkout the gh-pages branch
uses: actions/[email protected]
Expand Down
3 changes: 3 additions & 0 deletions ci/requirements/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ dependencies:
- sphinx-design
- sphinx-gallery
- sphinx_rtd_theme<3.0
# Dev dependencies (building PDF documentation)
# 'sphinxcontrib-svg2pdfconverter' is required since it's added to `extensions`.
- sphinxcontrib-svg2pdfconverter
8 changes: 8 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ html-noplot: api
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

pdf: latex
@echo
@echo "Building PDF via Tectonic."
@echo
tectonic $(BUILDDIR)/latex/pygmt.tex
@echo
@echo "PDF build finished. The PDF file is in $(BUILDDIR)/latex/pygmt.pdf."

server:
@echo
@echo "Running a server on port 8009."
Expand Down
8 changes: 6 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.doctest",
"sphinx.ext.viewcode",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
Copy link
Member Author

@seisman seisman Jan 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort all extensions alphabetically.

"sphinx_autodoc_typehints",
"sphinx_copybutton",
"sphinx_design",
"sphinx_gallery.gen_gallery",
"sphinxcontrib.cairosvgconverter",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the sphinxcontrib-svg2pdfconverter extension.

]

# Suppress warnings
Expand Down Expand Up @@ -248,3 +249,6 @@
"github_version": "main",
"commit": commit_link,
}

# Configurations for LaTeX
latex_engine = "xelatex"
Comment on lines +253 to +254
Copy link
Member Author

@seisman seisman Jan 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default latex engine is pdflatex, and it doens't support Unicode characters well. With latex_engine set to xelatex, Sphinx adds more tex packages (mainly fontenc and supports Unicode better.

4 changes: 4 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ dependencies:
- sphinx-design
- sphinx-gallery>=0.17.0
- sphinx_rtd_theme<3.0
# Dev dependencies (building PDF documentation)
- cairosvg
- sphinxcontrib-svg2pdfconverter
- tectonic
# Dev dependencies (type hints)
- mypy
- pandas-stubs
Loading