[PyGiNaC-users] latex patch - upgrade
Status: Alpha
Brought to you by:
jbrandmeyer
|
From: Ondrej C. <ond...@gm...> - 2005-04-26 10:55:12
|
The latex patch should have been implemented like this. Maybe you
could embed it in a better way.
O. Certik
--- pyginac-orig/src/basic.cpp 2005-03-30 22:55:17.000000000 +0200
+++ pyginac/src/basic.cpp 2005-04-26 12:47:31.176443904 +0200
@@ -397,6 +397,27 @@
return converter.returned_hash;
}
+//template< typename GinacPrintable>
+//print_to_string_latex(const GinacPrintable & This)
+/*std::string
+print_to_string_latex(const GiNaC::basic& This)
+{
+ std::ostringstream output;
+ output << GiNaC::latex;
+ output << This;
+ return output.str();
+}*/
+template< typename GinacPrintable>
+std::string
+print_to_string_latex( GinacPrintable* object)
+{
+ std::ostringstream output;
+ GiNaC::print_latex context( output);
+ object->print( context);
+ return output.str();
+}
+
+
} // !namespace anonymous
void
@@ -524,6 +545,7 @@
// Overrides for special Python object behavior
.def( "__str__", &print_to_string<basic>)
+ .def( "print_latex", &print_to_string_latex<basic>)
.def( "__hash__", wrap_hash, "Compute a hash of an expression.")
;
|