]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/misc.py
Add the misc module with the legend_latex() function.
[sage.d.git] / mjo / misc.py
diff --git a/mjo/misc.py b/mjo/misc.py
new file mode 100644 (file)
index 0000000..28113b6
--- /dev/null
@@ -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)