From 0c3f106bf9d1eb680a3429b8895077bb2d9c5812 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 27 Sep 2012 22:54:33 -0400 Subject: [PATCH] Add the misc module with the legend_latex() function. --- mjo/all.py | 1 + mjo/misc.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 mjo/misc.py 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) -- 2.43.2