2

I'd like to use the latex algpseudocode package to add algorithms to my docstrings. I'd also like to be able to define user macros to speed up my maths equation typing in the docstrings.

I'm using napoleon autodoc style with sphinx to generate documentation from my docstrings.

dan_sk8r
  • 41
  • 2

1 Answers1

2

To add your own preamble in Sphinx. Create your own sty files with the LaTex edits and additions you want. Let's call these first.sty, second.sty. Now, modify the conf.py file ref. Sphinx-doc latex preamble Basically, for the example.

latex_additional_files = ['first.sty', 'second.sty']
latex_elements = { 
'preamble': r'\usepackage{first}',
'preamble': r'\usepackage{second}',
}  

Run the following steps and verify the *.sty files show up in your buid/sphinx/latex directory, and your output includes your changes.

python setup.py build_sphinx -b latex
cd build/sphinx/latex
make
zerocog
  • 1,703
  • 21
  • 32