Re: [PyGiNaC-users] latex patch - upgrade
Status: Alpha
Brought to you by:
jbrandmeyer
From: Jonathan B. <jbr...@ea...> - 2005-04-27 02:43:29
|
On Tue, 2005-04-26 at 12:55 +0200, Ondrej Certik wrote: > The latex patch should have been implemented like this. Maybe you > could embed it in a better way. > O. Certik I'll take a look at the patch this weekend. I've been meaning to revisit the way stringification is done, anyway. -Jonathan > --- 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.") > ; > > > ------------------------------------------------------- > SF.Net email is sponsored by: Tell us your software development plans! > Take this survey and enter to win a one-year sub to SourceForge.net > Plus IDC's 2005 look-ahead and a copy of this survey > Click here to start! http://www.idcswdc.com/cgi-bin/survey?id5hix > _______________________________________________ > Pyginac-users mailing list > Pyg...@li... > https://lists.sourceforge.net/lists/listinfo/pyginac-users |