Documentation sources for the CALFEM Python and MATLAB manuals.
The documentation is built with Sphinx from the files in source/. Separate
Sphinx configurations are used for the Python and MATLAB manuals:
- Python:
source/conf_python/conf.py - MATLAB:
source/conf_matlab/conf.py
Build output is written below build/.
Install Conda or Mamba first. The examples below use Conda, but the same
commands work with Mamba by replacing conda with mamba.
For PDF/LaTeX builds you also need:
- A LaTeX distribution with
xelatexandlatexmk, for example MiKTeX on Windows or TeX Live on Linux/macOS. - The fonts used by the LaTeX configuration: Crimson Text, PT Sans, and Fira Code.
rsvg-convertfor converting SVG figures to PDF during LaTeX builds. The environment below installs this through the conda-forgelibrsvgpackage.
Create a conda-forge environment named sphinx-env:
conda create -n sphinx-env -c conda-forge python=3.11 pip make librsvg
conda activate sphinx-envInstall the Python documentation dependencies:
pip install -r requirements.txtCheck that Sphinx is available:
sphinx-build --versionClone the repository and enter the checkout:
git clone <repository-url> calfem-docs
cd calfem-docs
conda activate sphinx-envIf you already have the repository, update your checkout instead:
git pull
conda activate sphinx-envOn Windows, use the provided batch files:
.\make-python.bat html
.\make-matlab.bat htmlOr build both manuals:
.\make-all.bat htmlThe generated HTML entry points are:
build/python/html/index.htmlbuild/matlab/html/index.html
Build the PDF manuals with:
.\make-python.bat latexpdf
.\make-matlab.bat latexpdfOr build both PDF manuals:
.\make-all.bat latexpdfThe generated PDF files are written below:
build/python/latex/build/matlab/latex/
To generate only the LaTeX source files, use the latex target:
.\make-python.bat latex
.\make-matlab.bat latexThe batch files are thin wrappers around sphinx-build. These direct commands
are useful on Linux/macOS or when debugging a build:
sphinx-build -M html source build/python -c source/conf_python -t python
sphinx-build -M html source build/matlab -c source/conf_matlab -t matlabFor PDF builds:
sphinx-build -M latexpdf source build/python -c source/conf_python -t python
sphinx-build -M latexpdf source build/matlab -c source/conf_matlab -t matlabList available Sphinx targets:
.\make-python.bat
.\make-matlab.batCommon targets include:
html- build HTML documentation.latex- generate LaTeX source files.latexpdf- generate LaTeX source files and compile PDFs.clean- remove generated files for that manual.
If sphinx-build is not found, activate the environment and reinstall the
requirements:
conda activate sphinx-env
pip install -r requirements.txtIf PDF builds fail because xelatex or latexmk is missing, install or repair
your LaTeX distribution and make sure its binaries are on PATH.
If SVG conversion fails during a PDF build, check that rsvg-convert is
available:
rsvg-convert --version