@@ -330,7 +330,7 @@ def str_function(x):
330330 return x
331331 # Deal with special characters
332332 char_wrapper = r"{\char`\%s}"
333- x = "" .join (char_wrapper % c if c in "#$%&\^_{}~" else c for c in x )
333+ x = "" .join (char_wrapper % c if c in r "#$%&\^_{}~" else c for c in x )
334334 # Avoid grouping spaces into one
335335 x = x .replace (" " , "{ }" )
336336 # And dashes too, since it causes issues for the command line...
@@ -865,8 +865,9 @@ def _run_latex_(filename, debug=False, density=150, engine=None, png=False, do_i
865865 return "Error latexing slide."
866866 return return_suffix
867867
868+
868869class LatexCall :
869- """
870+ r """
870871 Typeset Sage objects via a ``__call__`` method to this class,
871872 typically by calling those objects' ``_latex_`` methods. The
872873 class :class:`Latex` inherits from this. This class is used in
@@ -1964,7 +1965,7 @@ def eval(self, x, globals=None, locals=None, mode='display',
19641965 # part should end in "}}", so omit the last two characters
19651966 # from y
19661967 y = part [:closing - 1 ]
1967- for delimiter in """|"'`#%&,.:;?!@_~^+-/\=<>()[]{}0123456789E""" :
1968+ for delimiter in r """|"'`#%&,.:;?!@_~^+-/\=<>()[]{}0123456789E""" :
19681969 if delimiter not in y :
19691970 break
19701971 if delimiter == "E" :
@@ -2420,7 +2421,7 @@ def repr_lincomb(symbols, coeffs):
24202421 # multiplication sign in
24212422 try :
24222423 if bv in CC :
2423- s += "%s\cdot %s" % (coeff , b )
2424+ s += r "%s\cdot %s" % (coeff , b )
24242425 else :
24252426 s += "%s%s" % (coeff , b )
24262427 except Exception :
@@ -2615,7 +2616,7 @@ def latex_variable_name(x, is_fname=False):
26152616 # * The "\d|[.,]" means "decimal digit" or period or comma
26162617 # * The "+" means "1 or more"
26172618 # * The "$" means "at the end of the line"
2618- m = re .search ('(\d|[.,])+$' ,x )
2619+ m = re .search (r '(\d|[.,])+$' , x )
26192620 if m is None :
26202621 prefix = x
26212622 suffix = None
@@ -2630,15 +2631,16 @@ def latex_variable_name(x, is_fname=False):
26302631 for sym in symtable .values ():
26312632 if sym [0 ] == '_' and sym [1 :] == suffix :
26322633 return latex_variable_name (suffix )
2633- if suffix and len (suffix ) > 0 :
2634+ if suffix and len (suffix ):
26342635 # handle the suffix specially because it very well might be numeric
26352636 # I use strip to avoid using regex's -- It makes it a bit faster (and the code is more comprehensible to non-regex'ed people)
2636- if suffix .strip ("1234567890" )!= "" :
2637+ if suffix .strip ("1234567890" ) != "" :
26372638 suffix = latex_variable_name (suffix , is_fname ) # recurse to deal with recursive subscripts
2638- return '%s_{%s}' % (latex_varify (prefix , is_fname ), suffix )
2639+ return '%s_{%s}' % (latex_varify (prefix , is_fname ), suffix )
26392640 else :
26402641 return latex_varify (prefix , is_fname )
26412642
2643+
26422644class LatexExamples ():
26432645 r"""
26442646 A catalogue of Sage objects with complicated ``_latex_`` methods.
0 commit comments