# HG changeset patch
# User Christian Stump <christian.stump at gmail.com>
# Date 1358242387 3600
# Node ID b1908ea96e267a2ffc2e0ed84f0931e33ce534a0
# Parent dae73a4694cbe91a3b3219ea0a4da05d63073707
trac 13955 latex output for Weyl group elements with prefix
diff git a/sage/combinat/root_system/weyl_group.py b/sage/combinat/root_system/weyl_group.py
a

b

class WeylGroupElement(MatrixGroupElemen 
806  806  ret += "%s%d*"%(self._parent._prefix, i) 
807  807  return ret + "%s%d"%(self._parent._prefix, redword[1]) 
808  808  
 809  def _latex_(self): 
 810  """ 
 811  EXAMPLES:: 
 812  
 813  sage: W = WeylGroup(['A',2,1], prefix="s") 
 814  sage: [s0,s1,s2]=W.simple_reflections() 
 815  sage: latex(s0*s1) # indirect doctest 
 816  s_{0}s_{1} 
 817  sage: W = WeylGroup(['A',2,1]) 
 818  sage: [s0,s1,s2]=W.simple_reflections() 
 819  sage: latex(s0*s1) 
 820  \left(\begin{array}{rrr} 
 821  0 & 1 & 2 \\ 
 822  1 & 1 & 1 \\ 
 823  0 & 0 & 1 
 824  \end{array}\right) 
 825  """ 
 826  if self._parent._prefix is None: 
 827  return MatrixGroupElement._latex_(self) 
 828  else: 
 829  redword = self.reduced_word() 
 830  if len(redword) == 0: 
 831  return "1" 
 832  else: 
 833  return "".join(["%s_{%d}"%(self._parent._prefix, i) for i in redword]) 
 834  
809  835  def matrix(self): 
810  836  """ 
811  837  Returns self as a matrix. 