Great. That worked:
import sympy
from sympy.printing.latex import LatexPrinter
class CustomLatexPrinter(LatexPrinter):
def _print_Adjoint(self, expr):
mat = expr.arg
from sympy.matrices import MatrixSymbol
if not isinstance(mat, MatrixSymbol):
return r"\left(%s\right)^H" % self._print(mat)
else:
return "%s^H" % self._print(mat)
def my_latex(expr, **settings):
return CustomLatexPrinter(settings).doprint(expr)
sympy.init_printing(latex_printer=my_latex)
One remaining question. init_session() does not seem to accept the
latex_printer argument. Is it passed in some other argument?
On Sunday, January 31, 2016 at 11:06:52 PM UTC-5, Jason Moore wrote:
>
> You can pass in the custom latex printer to init_printing or init_session
> as a kwarg.
>
> Jason
>
>
> Jason
> moorepants.info
> +01 530-601-9791
>
> On Sun, Jan 31, 2016 at 7:30 PM, Michael Hansen <[email protected]
> <javascript:>> wrote:
>
>> That will not work if I want to use it in an interactive session. There I
>> need the actual latex function overloaded since that is what it seems to
>> call. Is there a way to do that?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] <javascript:>
>> .
>> Visit this group at https://groups.google.com/group/sympy.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sympy/2b5347c3-8ebb-41b2-83d2-ead33860c6e7%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/fb250bd4-5771-4b02-b84c-d812d4744e00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.