+1, is it in your branch somewhere?

Ondrej

OnMon, May 3, 2010 at 3:32 AM, Øyvind Jensen <jensen.oyv...@gmail.com> wrote:
>   Before:   -1^{x}
>   Now:      \left(-1\right)^{x}
>
>   Added a test
> ---
>  sympy/printing/latex.py            |    3 ++-
>  sympy/printing/tests/test_latex.py |    3 +++
>  2 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py
> index cce22fc..b298be0 100644
> --- a/sympy/printing/latex.py
> +++ b/sympy/printing/latex.py
> @@ -83,7 +83,8 @@ def _needs_brackets(self, expr):
>         printed, False otherwise. For example: a + b => True; a => False;
>         10 => False; -10 => True.
>         """
> -        return not ((expr.is_Integer and expr.is_nonnegative) or 
> expr.is_Atom)
> +        return not ((expr.is_Integer and expr.is_nonnegative)
> +                or (expr.is_Atom and expr is not S.NegativeOne))
>
>     def _needs_function_brackets(self, expr):
>         """
> diff --git a/sympy/printing/tests/test_latex.py 
> b/sympy/printing/tests/test_latex.py
> index 7afaf28..8fad7ff 100644
> --- a/sympy/printing/tests/test_latex.py
> +++ b/sympy/printing/tests/test_latex.py
> @@ -94,6 +94,9 @@ def test_latex_functions():
>     assert latex(gamma(x)) == r"\operatorname{\Gamma}\left(x\right)"
>     assert latex(Order(x)) == r"\operatorname{\mathcal{O}}\left(x\right)"
>
> +def test_latex_brackets():
> +    assert latex((-1)**x) == r"\left(-1\right)^{x}"
> +
>  def test_latex_derivatives():
>     assert latex(diff(x**3, x, evaluate=False)) == \
>     r"\frac{\partial}{\partial x} x^{3}"
> --
> 1.6.5
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy-patches" group.
> To post to this group, send email to sympy-patc...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy-patches" group.
To post to this group, send email to sympy-patc...@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