MideTechnology / endaq-python

A comprehensive, user-centric Python API for working with enDAQ data and devices
MIT License
24 stars 12 forks source link

add LaTeX to docstrings #45

Open CrepeGoat opened 2 years ago

CrepeGoat commented 2 years ago

Currently, many of the docstrings (especially for the shock.py module) include mathematical equations that would be better rendered in LaTeX, but are currently written in unicode. It'd be nice to formally render these equations in LaTeX.

CrepeGoat commented 2 years ago

One thing I'm trying to keep in mind when considering a solution: docstrings are also accessible programmatically via the help function. So if we simply add LaTeX expressions to a docstring, the raw LaTeX code will be shown when calling help, which is not especially legible. So ideally we find a solution to accommodate both the rendered docs and the Python console printed docstrings.

StokesMIDE commented 2 years ago

The LaTeX also will not render in IDE popup text. I think the LaTeX would be better left in Sphinx documents.

S-Hanly commented 2 years ago

I just grabbed a random numpy function and they seem to do it in docstrings. But to @StokesMIDE 's point, they added the .. math:: thing before the equations so it only renders in the docs not in the IDE popup text. Can we do something similar? I do really like the equations in the docs. https://numpy.org/doc/stable/reference/generated/numpy.corrcoef.html

image

image image

StokesMIDE commented 2 years ago

@shanlyMIDE That popup behavior isn't standard; most environments just display it verbatim (or something close).