I think I did two things to cause the confussion:
1. I changed the name of the branch from inline to latex_mode (you may have
caught that)
2. I think I pushed to github without committing.  This is probably the main
problem.

The patch is attached.  I will fix the tests shortly.

On Thu, Jul 16, 2009 at 7:32 AM, Ryan Krauss <[email protected]> wrote:

> Sorry, I was on my way to bed when I checked my email one last time.
>
>
> On Wed, Jul 15, 2009 at 11:19 PM, Ondrej Certik <[email protected]> wrote:
>
>>
>> On Wed, Jul 15, 2009 at 9:41 PM, Ryan Krauss<[email protected]> wrote:
>> > Hmmm.  I may have pushed the wrong branch.  That patch doesn't look
>> > right.....
>>
>> I am still on IRC, feel free to come, we'll fix it.
>>
>> Ondrej
>>
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

From 0d2b7a2ac72b9cb1bc0f03d80cac1bea358fcb2b Mon Sep 17 00:00:00 2001
From: Ryan Krauss <[email protected]>
Date: Thu, 16 Jul 2009 07:39:03 -0500
Subject: [PATCH 1/1] Latex Printing: first part of changing from inline to mode

---
 sympy/printing/latex.py |   51 +++++++++++++++++++++++++++++++++++++---------
 1 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py
index 17f103e..c1c38a6 100644
--- a/sympy/printing/latex.py
+++ b/sympy/printing/latex.py
@@ -25,7 +25,7 @@ class LatexPrinter(Printer):
         }
 
         self._settings = {
-            "inline" : True,
+            "mode" : 'plain',
             "fold_frac_powers" : False,
             "fold_func_brackets" : False,
             "mul_symbol" : None,
@@ -33,6 +33,22 @@ class LatexPrinter(Printer):
         }
 
         if profile is not None:
+            if profile.has_key('inline'):
+                msg = "'inline' is deprecated, please use 'mode'.\n" + \
+                      "'mode' can be one of 'inline', 'plain', \n" + \
+                      "'equation', or 'equation*'."
+                print(msg)
+                if profile['inline']:
+                    profile['mode'] = 'inline'
+                else:
+                    profile['mode'] = 'equation*'
+            if profile.has_key('mode'):
+                valid_modes = ['inline', 'plain', 'equation', \
+                               'equation*']
+                if profile['mode'] not in valid_modes:
+                    msg = "'mode' must be one of 'inline', 'plain', \n" + \
+                          "'equation' or 'equation*'"
+                    raise ValueError, msg
             self._settings.update(profile)
 
         self._settings['mul_symbol_latex'] = \
@@ -41,12 +57,13 @@ class LatexPrinter(Printer):
     def doprint(self, expr):
         tex = Printer.doprint(self, expr)
 
-        if self._settings['inline'] is None:
+        if self._settings['mode'] == 'plain':
             return tex
-        elif self._settings['inline']:
+        elif self._settings['mode'] == 'inline':
             return r"$%s$" % tex
         else:
-            return r"\begin{equation*}%s\end{equation*}" % tex
+            env_str = self._settings['mode']
+            return r"\begin{%s}%s\end{%s}" % (env_str, tex, env_str)
 
     def _needs_brackets(self, expr):
         """
@@ -597,25 +614,39 @@ class LatexPrinter(Printer):
 def latex(expr, profile=None, **kargs):
     r"""Convert the given expression to LaTeX representation.
 
-        You can specify how the generated code will be delimited.
-        If the 'inline' keyword is set then inline LaTeX $ $ will
-        be used. Otherwise the resulting code will be enclosed in
-        'equation*' environment (remember to import 'amsmath').
+        You can specify how the generated code will be delimited using
+        the 'mode' keyword. 'mode' can be one of 'inline', 'equation',
+        'equation*', or 'plain'.  If 'mode' is set to 'inline' then
+        inline LaTeX $ $ will be used.  If 'mode' is set to 'equation'
+        or 'equation*', the resulting code will be enclosed in the
+        'equation' or 'equation*' environment (remember to import
+        'amsmath' for 'equation*').  If 'mode' is set to 'plain', then
+        the resulting code will not be delimited at all (this is the
+        default).
 
         >>> from sympy import *
         >>> from sympy.abc import *
 
         >>> latex((2*tau)**Rational(7,2))
+        '8 \\sqrt{2} \\sqrt[7]{\\tau}'
+
+        >>> latex((2*tau)**Rational(7,2), mode='inline')
         '$8 \\sqrt{2} \\sqrt[7]{\\tau}$'
 
-        >>> latex((2*mu)**Rational(7,2), inline=False)
+        >>> latex((2*mu)**Rational(7,2), mode='equation*')
         '\\begin{equation*}8 \\sqrt{2} \\sqrt[7]{\\mu}\\end{equation*}'
 
+        >>> latex((2*mu)**Rational(7,2), mode='equation')
+        '\\begin{equation}8 \\sqrt{2} \\sqrt[7]{\\mu}\\end{equation}'
+
+        >>> latex((2*mu)**Rational(7,2), mode='plain')
+        '8 \\sqrt{2} \\sqrt[7]{\\mu}'
+
         Besides all Basic based expressions, you can recursively
         convert Pyhon containers (lists, tuples and dicts) and
         also SymPy matrices:
 
-        >>> latex([2/x, y])
+        >>> latex([2/x, y], mode='inline')
         '$\\begin{bmatrix}\\frac{2}{x}, & y\\end{bmatrix}$'
 
     """
-- 
1.6.0.4

Reply via email to