Repository: sympy/sympy

Issue:
Physics vectors are raising printing errors
In the Jupyter notebook:
```python
import sympy as sm
import sympy.physics.mechanics as me
sm.init_printing()
a, b, c = sm.symbols('a, b, c')
A = me.ReferenceFrame('A')
v = a * A.x + b * A.y + c * A.z
w = b * A.x + c * A.y + a * A.z
w + v
```

gives:

```
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/opt/conda/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
    691                 type_pprinters=self.type_printers,
    692                 deferred_pprinters=self.deferred_printers)
--> 693             printer.pretty(obj)
    694             printer.flush()
    695             return stream.getvalue()

/opt/conda/lib/python3.6/site-packages/IPython/lib/pretty.py in pretty(self, obj)
    363                 if cls in self.type_pprinters:
    364                     # printer registered in self.type_pprinters
--> 365                     return self.type_pprinters[cls](obj, self, cycle)
    366                 else:
    367                     # deferred printer

/opt/conda/lib/python3.6/site-packages/sympy/interactive/printing.py in _print_plain(arg, p, cycle)
     66         """caller for pretty, for use in IPython 0.11"""
     67         if _can_print_latex(arg):
---> 68             p.text(stringify_func(arg))
     69         else:
     70             p.text(IPython.lib.pretty.pretty(arg))

/opt/conda/lib/python3.6/site-packages/sympy/physics/vector/printing.py in vpprint(expr, **settings)
    336 
    337     try:
--> 338         return pp.doprint(expr)
    339     finally:
    340         pretty_use_unicode(uflag)

/opt/conda/lib/python3.6/site-packages/sympy/printing/pretty/pretty.py in doprint(self, expr)
     60 
     61     def doprint(self, expr):
---> 62         return self._print(expr).render(**self._settings)
     63 
     64     # empty op so _print(stringPict) returns the same

/opt/conda/lib/python3.6/site-packages/sympy/physics/vector/vector.py in render(self, *args, **kwargs)
    283                                 pform = vp._print(
    284                                     ar[i][0][j])
--> 285                             pform = prettyForm(*pform.right(" ",
    286                                                 ar[i][1].pretty_vecs[j]))
    287                         else:

AttributeError: 'tuple' object has no attribute 'right'
```

Discussion:

Patch:
diff --git a/sympy/physics/vector/vector.py b/sympy/physics/vector/vector.py
index 8849119218..5fff93fded 100644
--- a/sympy/physics/vector/vector.py
+++ b/sympy/physics/vector/vector.py
@@ -272,18 +272,18 @@ def render(self, *args, **kwargs):
                         # if the coef of the basis vector is -1, we skip the 1
                         elif ar[i][0][j] == -1:
                             pform = vp._print(ar[i][1].pretty_vecs[j])
-                            pform= prettyForm(*pform.left(" - "))
+                            pform = prettyForm(*pform.left(" - "))
                             bin = prettyForm.NEG
                             pform = prettyForm(binding=bin, *pform)
                         elif ar[i][0][j] != 0:
                             # If the basis vector coeff is not 1 or -1,
                             # we might wrap it in parentheses, for readability.
+                            pform = vp._print(ar[i][0][j])
+
                             if isinstance(ar[i][0][j], Add):
-                                pform = vp._print(
-                                    ar[i][0][j]).parens()
-                            else:
-                                pform = vp._print(
-                                    ar[i][0][j])
+                                tmp = pform.parens()
+                                pform = prettyForm(tmp[0], tmp[1])
+
                             pform = prettyForm(*pform.right(" ",
                                                 ar[i][1].pretty_vecs[j]))
                         else:


Test patch:
diff --git a/sympy/physics/vector/tests/test_printing.py b/sympy/physics/vector/tests/test_printing.py
index 28d249c1a4..83086a2179 100644
--- a/sympy/physics/vector/tests/test_printing.py
+++ b/sympy/physics/vector/tests/test_printing.py
@@ -200,3 +200,23 @@ def test_vlatex(): # vlatex is broken #12078
     expr = J*f(x).diff(x).subs(f(x), g(x)-h(x))
 
     assert vlatex(expr) == expected
+
+
+def test_issue_13354():
+    """
+    Test for proper pretty printing of physics vectors with ADD
+    instances in arguments.
+
+    Test is exactly the one suggested in the original bug report by
+    @moorepants.
+    """
+
+    a, b, c = symbols('a, b, c')
+    A = ReferenceFrame('A')
+    v = a * A.x + b * A.y + c * A.z
+    w = b * A.x + c * A.y + a * A.z
+    z = w + v
+
+    expected = """(a + b) a_x + (b + c) a_y + (a + c) a_z"""
+
+    assert ascii_vpretty(z) == expected