Repository: sympy/sympy

Issue:
Error displaying indexes in VS Code
I am not sure if this is a Sympy bug or a VS Code one. 
When working with Idx I am unable to display my equations. I get the following error:
`ParseError: KaTeX parse error: Undefined control sequence: \nobreakJ at position 33: …_{0\mathrel{..}\̲n̲o̲b̲r̲e̲a̲k̲J̲ ̲- 1}`

As you may see, there is an space missing between the "\nobreak" and the index upper limit "J".

My code is:
```
import sympy as sp
J = sp.symbols('J')
j = sp.Idx('j', J)
display(j)
```

 
 
 
 
 
 
 
 
 
 
 
 
 
 



Discussion:

Patch:
diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py
index 6653b9468e..381d21a0da 100644
--- a/sympy/printing/latex.py
+++ b/sympy/printing/latex.py
@@ -790,7 +790,7 @@ def _print_Idx(self, expr):
                 lower = self._print(expr.lower)
             else:
                 lower = self._print(S.Zero)
-            interval = '{lower}\\mathrel{{..}}\\nobreak{upper}'.format(
+            interval = '{lower}\\mathrel{{..}}\\nobreak {upper}'.format(
                     lower = lower, upper = upper)
             return '{{{label}}}_{{{interval}}}'.format(
                 label = label, interval = interval)


Test patch:
diff --git a/sympy/printing/tests/test_latex.py b/sympy/printing/tests/test_latex.py
index aac065ca05..af67e2b0a0 100644
--- a/sympy/printing/tests/test_latex.py
+++ b/sympy/printing/tests/test_latex.py
@@ -751,7 +751,7 @@ def test_latex_indexed():
     assert indexed_latex == r'\overline{{\Psi}_{0}} {\Psi}_{0}'
 
     # Symbol('gamma') gives r'\gamma'
-    interval = '\\mathrel{..}\\nobreak'
+    interval = '\\mathrel{..}\\nobreak '
     assert latex(Indexed('x1', Symbol('i'))) == r'{x_{1}}_{i}'
     assert latex(Indexed('x2', Idx('i'))) == r'{x_{2}}_{i}'
     assert latex(Indexed('x3', Idx('i', Symbol('N')))) == r'{x_{3}}_{{i}_{0'+interval+'N - 1}}'