Golam Mortuza Hossain wrote: > Hi Jason, > > On Wed, Mar 25, 2009 at 11:57 AM, Jason Grout <jason-s...@creativetrax.com> >> Can you post your patch that makes the functions typeset as greek >> letters? > > This is my first attempt to modify Sage. So please feel free > to correct me. Let me mention the changes I have made > to get the elementary support for typesetting functions > as Greek letters. > > > (1) In file: "sage/misc/latex.py", I have added a function after the list > "common_varnames" as follows > -------------------------------------- > def is_common_varname(a): > """ > Checks whether it is a common variable name such as alpha, beta > """ > if a in common_varnames: > return True > else: > return False
Why not just: return a in common_varnames which I think is equivalent. Also, I think naming the function is_latex_name or something like that would be better. common_varnames says nothing to me about the variable name actually being a latex command which produces a symbol (yes, I know you're just inheriting the current behavior, so it's not your fault). > ---------------------------------- > > (2) In file: "sage/calculus/calculus.py", change the line > "from sage.misc.latex import latex, latex_variable_name" > to > "from sage.misc.latex import latex, latex_variable_name, is_common_varname" > > and in _latex_(self) function for "class SymbolicFunctionEvaluation" > I have added following three lines > -------------------------------------------------------- > + n = self._f._name > + if is_common_varname(n): > + return "\\%s(%s)"%(n, ', '.join([x._latex_() for x in > self._args])) > try: > return latex(self._maxima_()) > --------------------------------------------------------- Do you want x._latex_() or latex(x)? I believe latex(x) tries to be smarter than x._latex_(), in that it tries to do sensible things when x._latex_() doesn't exist. Good job! I'm glad you're working on this. Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---