From: Michael Orlitzky Date: Fri, 28 Sep 2012 02:54:33 +0000 (-0400) Subject: Add the misc module with the legend_latex() function. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;ds=inline;h=0c3f106bf9d1eb680a3429b8895077bb2d9c5812;p=sage.d.git Add the misc module with the legend_latex() function. --- diff --git a/mjo/all.py b/mjo/all.py index c3f0ef8..58a993d 100644 --- a/mjo/all.py +++ b/mjo/all.py @@ -3,5 +3,6 @@ Import all of the other code, so that the user doesn't have to do it in his script. Instead, he can just `from mjo.all import *`. """ +from misc import * from plot import * from symbolic import * diff --git a/mjo/misc.py b/mjo/misc.py new file mode 100644 index 0000000..28113b6 --- /dev/null +++ b/mjo/misc.py @@ -0,0 +1,13 @@ +""" +Stuff that doesn't fit anywhere else. +""" + +from sage.all import * + +def legend_latex(obj): + """ + Return the LaTeX representation of `obj`, but wrap it in dollar + ($) signs so that we can pass it directly to plot() et al. as a + legend label. + """ + return '$%s$' % latex(obj)