Repository: LMFDB/lmfdb

Issue:
Handling long Artin rep labels
On Artin representation pages like [this one](https://beta.lmfdb.org/ArtinRepresentation/64.91641670748848482832403196711945603240247718111273033244589178562712452372568054853495805267834328481580386515777517380942993629003169127244600785859214182603634034597536619998685360883426251038869742819115533880506609428884855573755881411446556815069418421014037949117475102106370659846354282996796928548392095158824994261231634684500171550501405225850346102377743167791739485384057130734154900626854500288026058857501770814530644432993058036873304718121461267084345344.168.a) the label of the Artin representation is so long that it makes the page hard to read (in addition to horizontal scrolling it pushes the proporty box far down the screen.  There is also a problem with number field pages that reference Artin representations with very long labels, like [this one](https://beta.lmfdb.org/NumberField/8.0.5620066455663197695561554590870531303687507769819136.1).

We don't want to change the labels (they have already been changed once), we just need to handle displaying them in a reasonable way.  We already have a mechanism for displaying very large integers using "bigint knowls" and it would make sense to do something similar here.  Concretely, the suggestion would be to display to replace the middle of the conductor part of the label with "..." so that it would appear as
```
64.916...344.168.a
```
except in the header, where it would appear as it currently does (and run of the edge of the screen but at least be visible with horizontal scrolling).  Where the conductor is displayed we can use a "bigint" knowl that shows the full conductor when clicked, but the shortened labels should not be knowls (they may already be links).




Discussion:

Resolving patch:
diff --git a/lmfdb/artin_representations/main.py b/lmfdb/artin_representations/main.py
--- a/lmfdb/artin_representations/main.py
+++ b/lmfdb/artin_representations/main.py
@@ -25,7 +25,7 @@
 from lmfdb.artin_representations import artin_representations_page
 #from lmfdb.artin_representations import artin_logger
 from lmfdb.artin_representations.math_classes import (
-    ArtinRepresentation, num2letters)
+    ArtinRepresentation, num2letters, artin_label_pretty)
 
 
 LABEL_RE = re.compile(r'^\d+\.\d+\.\d+(t\d+)?\.[a-z]+\.[a-z]+$')
@@ -307,7 +307,7 @@ def render_artin_representation_webpage(label):
         allchars = [ ArtinRepresentation(newlabel+'.'+num2letters(j)).character_formatted() for j in range(1,num_conj+1)]
 
     label = newlabel
-    bread = get_bread([(label, ' ')])
+    bread = get_bread([(artin_label_pretty(label), ' ')])
 
     #artin_logger.info("Found %s" % (the_rep._data))
 
@@ -320,7 +320,7 @@ def render_artin_representation_webpage(label):
         processed_root_number = "not computed"
     else:
         processed_root_number = str(the_rep.sign())
-    properties = [("Label", label),
+    properties = [("Label", artin_label_pretty(label)),
                   ("Dimension", str(the_rep.dimension())),
                   ("Group", the_rep.group()),
                   ("Conductor", "$" + the_rep.factored_conductor_latex() + "$")]
@@ -370,14 +370,14 @@ def render_artin_representation_webpage(label):
             friends.append(("L-function", url_for("l_functions.l_function_artin_page",
                                               label=the_rep.label())))
         orblabel = re.sub(r'\.[a-z]+$', '', label)
-        friends.append(("Galois orbit "+orblabel,
+        friends.append(("Galois orbit " + artin_label_pretty(orblabel),
             url_for(".render_artin_representation_webpage", label=orblabel)))
     else:
         add_lfunction_friends(friends,label)
         friends.append(("L-function", url_for("l_functions.l_function_artin_page", label=the_rep.label())))
         for j in range(1,1+the_rep.galois_conjugacy_size()):
             newlabel = label+'.'+num2letters(j)
-            friends.append(("Artin representation "+newlabel,
+            friends.append(("Artin representation " + artin_label_pretty(newlabel),
                 url_for(".render_artin_representation_webpage", label=newlabel)))
 
     info={} # for testing
diff --git a/lmfdb/artin_representations/math_classes.py b/lmfdb/artin_representations/math_classes.py
--- a/lmfdb/artin_representations/math_classes.py
+++ b/lmfdb/artin_representations/math_classes.py
@@ -11,6 +11,12 @@
 from lmfdb.characters.web_character import WebSmallDirichletCharacter
 import re
 
+# abbreviate labels with large conductors for display purposes
+def artin_label_pretty(label):
+    s = label.split('.')
+    if len(s[1]) > 20:
+        s[1] = s[1][:3] + "..." + s[1][-3:]
+    return '.'.join(s)
 
 # fun is the function, N the modulus, and n the denominator
 # for values (value a means e(a/n))
@@ -120,6 +126,9 @@ def baselabel(self):
     def label(self):
         return str(self._data['label'])
 
+    def label_pretty(self):
+        return artin_label_pretty(self._data['label'])
+
     def dimension(self):
         return int(self._data["Dim"])
 
@@ -151,14 +160,15 @@ def determinant(self):
         return self.central_character_as_artin_rep().label()
 
     def conductor_equation(self):
+        from lmfdb.utils import bigint_knowl
         # Returns things of the type "1", "7", "49 = 7^{2}"
         factors = self.factored_conductor()
         if self.conductor() == 1:
             return "1"
         if len(factors) == 1 and factors[0][1] == 1:
-            return str(self.conductor())
+            return bigint_knowl(self.conductor(),sides=3)
         else:
-            return str(self.conductor()) + "=" + self.factored_conductor_latex()
+            return bigint_knowl(self.conductor(),sides=3) + r"\(\medspace = " + self.factored_conductor_latex() + r"\)"
 
     def factored_conductor(self):
         return [(p, valuation(Integer(self.conductor()), p)) for p in self.bad_primes()]
diff --git a/lmfdb/number_fields/number_field.py b/lmfdb/number_fields/number_field.py
--- a/lmfdb/number_fields/number_field.py
+++ b/lmfdb/number_fields/number_field.py
@@ -592,12 +592,13 @@ def render_field_webpage(args):
         downloads.append(('Download {} code'.format(lang[0]),
                           url_for(".nf_download", nf=label_orig, download_type=lang[1])))
     from lmfdb.artin_representations.math_classes import NumberFieldGaloisGroup
+    from lmfdb.artin_representations.math_classes import artin_label_pretty
     try:
         info["tim_number_field"] = NumberFieldGaloisGroup(nf._data['coeffs'])
         arts = [z.label() for z in info["tim_number_field"].artin_representations()]
         #print arts
         for ar in arts:
-            info['friends'].append(('Artin representation '+str(ar),
+            info['friends'].append(('Artin representation '+artin_label_pretty(ar),
                 url_for("artin_representations.render_artin_representation_webpage", label=ar)))
         v = nf.factor_perm_repn(info["tim_number_field"])
 


Test patch: