Skip to content

Commit b5da322

Browse files
authored
Move documentation for a single printer function to the source code (#301)
This is an example of how gh-300 can be addressed.
1 parent 3883eca commit b5da322

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

doc/module-components.rst

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -804,25 +804,9 @@ Latex Printing
804804

805805
For latex printing one uses one functions from the ``ga`` module and one function from the ``printer`` module. The functions are
806806

807-
.. function:: Format(Fmode=True,Dmode=True)
807+
.. autofunction:: galgebra.printer.Format
808808
:noindex:
809809

810-
This function from the ``ga`` module turns on latex printing with the following options
811-
812-
+-----------+-----------+-----------------------------------------------------------------------------------------+
813-
| Argument | Value | Result |
814-
+===========+===========+=========================================================================================+
815-
| ``Fmode`` | ``True`` | Print functions without argument list, :math:`f` |
816-
+-----------+-----------+-----------------------------------------------------------------------------------------+
817-
| | ``False`` | Print functions with standard *sympy* latex formatting, :math:`{{f}\lp {x,y,z} \rp }` |
818-
+-----------+-----------+-----------------------------------------------------------------------------------------+
819-
| ``Dmode`` | ``True`` | Print partial derivatives with condensed notation, :math:`\partial_{x}f` |
820-
+-----------+-----------+-----------------------------------------------------------------------------------------+
821-
| | ``False`` | Print partial derivatives with standard *sympy* latex formatting, :math:`\pdiff{f}{x}` |
822-
+-----------+-----------+-----------------------------------------------------------------------------------------+
823-
824-
``Format()`` is also required for printing from *ipython notebook* (note that ``xpdf()`` is not needed to print from *ipython notebook*).
825-
826810
.. function:: Fmt(obj,fmt=1)
827811
:noindex:
828812

galgebra/printer.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -902,14 +902,22 @@ def print_latex(expr, **settings):
902902
print(latex(expr, **settings))
903903

904904

905-
def Format(Fmode=True, Dmode=True, dop=1, inverse='full'):
906-
"""
907-
Set modes for latex printer -
905+
def Format(Fmode: bool = True, Dmode: bool = True, dop=1, inverse='full'):
906+
r"""
907+
Turns on latex printing with configurable options.
908+
909+
This redirects printer output so that latex compiler can capture it.
908910
909-
Fmode: Suppress function arguments (True) Use sympy latex for functions (False)
910-
Dmode: Use compact form of derivatives (True) Use sympy latex for derivatives (False)
911+
``Format()`` is also required for printing from *ipython notebook* (note that ``xpdf()`` is not needed to print from *ipython notebook*).
911912
912-
and redirects printer output so that latex compiler can capture it.
913+
Parameters
914+
----------
915+
Fmode:
916+
* ``True`` -- Print functions without argument list, :math:`f`
917+
* ``False`` -- Print functions with standard *sympy* latex formatting, :math:`{{f}\lp {x,y,z} \rp }`
918+
Dmode:
919+
* ``True`` -- Print partial derivatives with condensed notation, :math:`\partial_{x}f`
920+
* ``False`` -- Print partial derivatives with standard *sympy* latex formatting, :math:`\pdiff{f}{x}`
913921
"""
914922
global Format_cnt
915923

0 commit comments

Comments
 (0)