Printing for Geometric Algebra

Class Reference

class sympy.galgebra.printing.enhance_print(base=None, fct=None, deriv=None, on=True, keys=False)

A class for color coding the string printing going to a terminal.

class sympy.galgebra.printing.GA_Printer(settings=None)

An enhanced string printer that is galgebra-aware.

class sympy.galgebra.printing.GA_LatexPrinter(settings=None)

An enhanced LaTeX printer that is galgebra-aware.

The latex printer is turned on with the function (in ga.py) -

Format(Fmode=True,Dmode=True,ipy=False)

where Fmode is the function printing mode that surpresses printing arguments, Dmode is the derivative printing mode that does not use fractions, and ipy=True is the Ipython notebook mode that does not redirect the print output.

The latex output is post processed and displayed with the function (in GAPrint.py) -

xdvi(filename=’tmplatex.tex’,debug=False)

where filename is the name of the tex file one would keep for future inclusion in documents and debug=True would display the tex file immediately.

There are three options for printing multivectors in latex. They are acessed with the multivector member function -

A.Fmt(self,fmt=1,title=None)

where fmt=1, 2, or 3 determines whether the entire multivector A is printed entirely on one line, or one grade is printed per line, or one base is printed per line. If title is not None then the latex string generated is of the form -

title+’ = ‘+str(A)

where it is assumed that title is a latex math mode string. If title contains ‘%’ it is treated as a pure latex math mode string. If it does not contain ‘%’ then the following character mappings are applied -

  • ‘grad’ replaced by ‘\bm{\nabla} ‘
  • ‘*’ replaced by ‘’
  • ‘^’ replaced by ‘\W ‘
  • ‘|’ replaced by ‘\cdot ‘
  • ‘>’ replaced by ‘\lfloor ‘
  • ‘<’ replaced by ‘\rfloor ‘

In the case of a print statement of the form -

print(title,A)

everthing in the title processing still applies except that the multivector formatting is one multivector per line.

For print statements of the form -

print(title)

where no program variables are printed if title contains ‘#’ then title is printed as regular latex line. If title does not contain ‘#’ then title is printed in equation mode. ‘%’ has the same effect in title as in the Fmt() member function.

Function Reference

sympy.galgebra.printing.find_executable(executable, path=None)

Try to find ‘executable’ in the directories listed in ‘path’ (a string listing directories separated by ‘os.pathsep’; defaults to os.environ[‘PATH’]). Returns the complete filename or None if not found

sympy.galgebra.printing.Get_Program(off=False)
sympy.galgebra.printing.latex(expr, **settings)

Return the LaTeX representation of the given expression.

sympy.galgebra.printing.Print_Function()
sympy.galgebra.printing.print_latex(expr, **settings)

Print the LaTeX representation of the given expression.

sympy.galgebra.printing.xdvi(filename=None, debug=False, paper=(14, 11))

Post processes LaTeX output (see comments below), adds preamble and postscript, generates tex file, inputs file to latex, displays resulting pdf file.