This is useful for example when pretty printing to non-terminals
(web browsers via html, etc.)
---
 sympy/printing/pretty/pretty.py                    |   19 +++++++++++++++----
 sympy/printing/pretty/tests/test_pretty_unicode.py |    6 ++++++
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/sympy/printing/pretty/pretty.py b/sympy/printing/pretty/pretty.py
index 9a31e46..da335f0 100644
--- a/sympy/printing/pretty/pretty.py
+++ b/sympy/printing/pretty/pretty.py
@@ -21,13 +21,18 @@ def __init__(self, profile=None):
         self._settings = {
                 "full_prec" : "auto",
                 "use_unicode" : True,
+                "wrap_line" : True,
         }
 
         if profile is not None:
             self._settings.update(profile)
 
     def doprint(self, expr):
-        return self._print(expr).terminal_string()
+        if self._settings["wrap_line"]:
+           return self._print(expr).terminal_string()
+        if self._settings["use_unicode"]:
+            return unicode(self._print(expr))
+        return str(self._print(expr))
 
     # empty op so _print(stringPict) returns the same
     def _print_stringPict(self, e):
@@ -591,9 +596,15 @@ def __print_set(self, s):
 
 def pretty(expr, profile=None, **kargs):
     """
-    Returns a string containing the prettified form of expr. If use_unicode
-    is set to True then certain expressions will use unicode characters,
-    such as the greek letter pi for Pi instances.
+    Returns a string containing the prettified form of expr. 
+    
+    Arguments
+    ---------
+    expr: the expression to print
+    wrap_line: line wrapping enabled/disabled, should be a boolean value 
(default to True)
+    use_unicode: use unicode characters, such as the greek letter pi instead 
of 
+        the string pi. Values should be boolean or None
+    full_prec: use full precission. Default to "auto"
     """
     if profile is not None:
         profile.update(kargs)
diff --git a/sympy/printing/pretty/tests/test_pretty_unicode.py 
b/sympy/printing/pretty/tests/test_pretty_unicode.py
index ee7bb16..5e22b00 100644
--- a/sympy/printing/pretty/tests/test_pretty_unicode.py
+++ b/sympy/printing/pretty/tests/test_pretty_unicode.py
@@ -386,3 +386,9 @@ def test_upretty_seq_even():
 """
     assert u == s
 
+def test_pretty_no_wrap_line():
+    huge_expr = 0
+    for i in range(20):
+        huge_expr += i*sin(i+x)
+    assert pretty(huge_expr            ).find('\n') != -1
+    assert pretty(huge_expr, wrap_line=False).find('\n') == -1
-- 
1.6.1.2


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

Reply via email to