27
27
from sage .categories .drinfeld_modules import DrinfeldModules
28
28
from sage .categories .homset import Hom
29
29
from sage .misc .latex import latex
30
+ from sage .misc .latex import latex_variable_name
30
31
from sage .misc .lazy_string import _LazyString
31
32
from sage .rings .integer import Integer
32
33
from sage .rings .polynomial .ore_polynomial_element import OrePolynomial
@@ -174,13 +175,6 @@ class DrinfeldModule(Parent, UniqueRepresentation):
174
175
sage: phi(1) # phi_1
175
176
1
176
177
177
- One can give a LaTeX name to be used for LaTeX representation::
178
-
179
- sage: sigma = DrinfeldModule(A, [z, 1, 1], latexname='\sigma')
180
- ...
181
- sage: latex(sigma)
182
- \sigma
183
-
184
178
.. RUBRIC:: The category of Drinfeld modules
185
179
186
180
Drinfeld modules have their own category (see class
@@ -507,7 +501,7 @@ class DrinfeldModule(Parent, UniqueRepresentation):
507
501
"""
508
502
509
503
@staticmethod
510
- def __classcall_private__ (cls , function_ring , gen , name = 't' , latexname = None ):
504
+ def __classcall_private__ (cls , function_ring , gen , name = 't' ):
511
505
"""
512
506
Check input validity and return a ``DrinfeldModule`` or
513
507
``FiniteDrinfeldModule`` object accordingly.
@@ -523,9 +517,6 @@ def __classcall_private__(cls, function_ring, gen, name='t', latexname=None):
523
517
- ``name`` (default: ``'t'``) -- the name of the Ore polynomial
524
518
ring gen
525
519
526
- - ``latexname`` (default: ``None``) -- the LaTeX name of the Drinfeld
527
- module
528
-
529
520
OUTPUT:
530
521
531
522
A DrinfeldModule or FiniteDrinfeldModule.
@@ -586,10 +577,6 @@ def __classcall_private__(cls, function_ring, gen, name='t', latexname=None):
586
577
base_field_noext .has_coerce_map_from (function_ring .base_ring ())):
587
578
raise ValueError ('function ring base must coerce into base field' )
588
579
589
- # Check LaTeX name
590
- if latexname is not None and type (latexname ) is not str :
591
- raise ValueError ('LaTeX name should be a string' )
592
-
593
580
# Build the category
594
581
T = function_ring .gen ()
595
582
if isinstance (base_field_noext , RingExtension_generic ):
@@ -613,10 +600,10 @@ def __classcall_private__(cls, function_ring, gen, name='t', latexname=None):
613
600
# Instantiate the appropriate class
614
601
if base_field .is_finite ():
615
602
from sage .rings .function_field .drinfeld_modules .finite_drinfeld_module import FiniteDrinfeldModule
616
- return FiniteDrinfeldModule (gen , category , latexname )
617
- return cls .__classcall__ (cls , gen , category , latexname )
603
+ return FiniteDrinfeldModule (gen , category )
604
+ return cls .__classcall__ (cls , gen , category )
618
605
619
- def __init__ (self , gen , category , latexname = None ):
606
+ def __init__ (self , gen , category ):
620
607
"""
621
608
Initialize ``self``.
622
609
@@ -634,9 +621,6 @@ def __init__(self, gen, category, latexname=None):
634
621
- ``name`` (default: ``'t'``) -- the name of the Ore polynomial
635
622
ring gen
636
623
637
- - ``latexname`` (default: ``None``) -- the LaTeX name of the Drinfeld
638
- module
639
-
640
624
TESTS::
641
625
642
626
sage: Fq = GF(25)
@@ -656,8 +640,6 @@ def __init__(self, gen, category, latexname=None):
656
640
True
657
641
sage: phi._morphism == Hom(A, ore_polring)(phi._gen)
658
642
True
659
- sage: phi._latexname is None
660
- True
661
643
662
644
::
663
645
@@ -666,7 +648,6 @@ def __init__(self, gen, category, latexname=None):
666
648
self ._base = category .base ()
667
649
self ._function_ring = category .function_ring ()
668
650
self ._gen = gen
669
- self ._latexname = latexname
670
651
self ._morphism = category ._function_ring .hom ([gen ])
671
652
self ._ore_polring = gen .parent ()
672
653
self ._Fq = self ._function_ring .base_ring () # Must be last
@@ -776,8 +757,8 @@ def _latex_(self):
776
757
r"""
777
758
Return a LaTeX representation of the Drinfeld module.
778
759
779
- If a LaTeX name was given at initialization, we use it.
780
- Otherwise, we create a representation.
760
+ If a representation name is given with meth:`rename`, it is
761
+ taken into account for LaTeX representation.
781
762
782
763
EXAMPLES::
783
764
@@ -791,20 +772,13 @@ def _latex_(self):
791
772
792
773
::
793
774
794
- sage: psi = DrinfeldModule(A, [p_root, z12^3, z12^5], latexname='\psi')
795
- ...
796
- sage: latex(psi)
797
- \psi
798
-
799
- ::
800
-
801
- sage: psi = DrinfeldModule(A, [p_root, z12^3, z12^5], latexname=1729)
802
- Traceback (most recent call last):
803
- ...
804
- ValueError: LaTeX name should be a string
775
+ sage: phi.rename('phi')
776
+ sage: latex(phi)
777
+ \phi
778
+ sage: phi.reset_name()
805
779
"""
806
- if self . _latexname is not None :
807
- return self . _latexname
780
+ if hasattr ( self , '__custom_name' ) :
781
+ return latex_variable_name ( getattr ( self , '__custom_name' ))
808
782
else :
809
783
return f'\\ phi: { latex (self ._function_ring .gen ())} \\ mapsto ' \
810
784
f'{ latex (self ._gen )} '
0 commit comments