Ticket #14382: trac_14382_doctests.2.patch

File trac_14382_doctests.2.patch, 6.2 KB (added by novoselt, 8 years ago)
  • doc/de/tutorial/latex.rst

    # HG changeset patch
    # User Andrey Novoseltsev <novoselt@gmail.com>
    # Date 1368731554 21600
    # Node ID 56a86cf42c78791efc61fa10db7e45412cbaac86
    # Parent  fa7038f49d4e5dffcb7b0a07831e8b4e209d6616
    Fix doctests with LaTeX code of strings.
    
    diff --git a/doc/de/tutorial/latex.rst b/doc/de/tutorial/latex.rst
    a b  
    6666    sage: latex(integrate(z^4, z))
    6767    \frac{1}{5} \, z^{5}
    6868    sage: latex('a string')
    69     \verb|a|\phantom{\verb!x!}\verb|string|
     69    \text{\tt a{ }string}
    7070    sage: latex(QQ)
    7171    \Bold{Q}
    7272    sage: latex(matrix(QQ, 2, 3, [[2,4,6],[-1,-1,-1]]))
  • doc/en/tutorial/latex.rst

    diff --git a/doc/en/tutorial/latex.rst b/doc/en/tutorial/latex.rst
    a b  
    6363    sage: latex(integrate(z^4, z))
    6464    \frac{1}{5} \, z^{5}
    6565    sage: latex('a string')
    66     \verb|a|\phantom{\verb!x!}\verb|string|
     66    \text{\tt a{ }string}
    6767    sage: latex(QQ)
    6868    \Bold{Q}
    6969    sage: latex(matrix(QQ, 2, 3, [[2,4,6],[-1,-1,-1]]))
  • sage/combinat/free_module.py

    diff --git a/sage/combinat/free_module.py b/sage/combinat/free_module.py
    a b  
    18351835            sage: F = CombinatorialFreeModule(QQ, [('a', 'b'), (0,1,2)])
    18361836            sage: e = F.basis()
    18371837            sage: latex(e[('a','b')])    # indirect doctest
    1838             B_{\left(a, b\right)}
     1838            B_{('a', 'b')}
    18391839            sage: latex(2*e[(0,1,2)])    # indirect doctest
    18401840            2B_{\left(0, 1, 2\right)}
    18411841            sage: F = CombinatorialFreeModule(QQ, [('a', 'b'), (0,1,2)], prefix="")
     
    18461846        from sage.misc.latex import latex
    18471847
    18481848        s = latex(m)
    1849         if s.find('\\verb') != -1:
    1850             import re
    1851             s = re.sub("\\\\verb(.)(.*?)\\1", "\\2", s)
    1852             s = s.replace("\\phantom{x}", " ")
     1849        if s.find(r'\text{\tt ') != -1:
     1850            # m contains "non-LaTeXed" strings, use string representation
     1851            s = str(m)
    18531852
    18541853        # dictionary with left-right pairs of "brackets".  put pairs
    18551854        # in here accept \\left and \\right as prefixes.
     
    24042403                sage: F.rename("F")
    24052404                sage: G.rename("G")
    24062405                sage: latex(tensor([F, F, G])) # indirect doctest
    2407                 \verb|F| \otimes \verb|F| \otimes \verb|G|
     2406                \text{\tt F} \otimes \text{\tt F} \otimes \text{\tt G}
    24082407                sage: F._latex_ = lambda : "F"
    24092408                sage: G._latex_ = lambda : "G"
    24102409                sage: latex(tensor([F, F, G])) # indirect doctest
  • sage/graphs/generic_graph.py

    diff --git a/sage/graphs/generic_graph.py b/sage/graphs/generic_graph.py
    a b  
    1498414984              "0" -- "1";
    1498514985              "0" -- "2";
    1498614986              "1" -- "2";
    14987               "2" -- "3" [label=" ", texlbl="$\verb|foo|$"];
     14987              "2" -- "3" [label=" ", texlbl="$\text{\tt foo}$"];
    1498814988            }
    1498914989
    1499014990        Same, with a digraph and a color for edges::
  • sage/groups/perm_gps/permgroup.py

    diff --git a/sage/groups/perm_gps/permgroup.py b/sage/groups/perm_gps/permgroup.py
    a b  
    14221422
    14231423            sage: S = SymmetricGroup(['a','b','c'])
    14241424            sage: latex(S)
    1425             \langle (\verb|a|,\verb|b|,\verb|c|), (\verb|a|,\verb|b|) \rangle
     1425            \langle (\text{\tt a},\text{\tt b},\text{\tt c}), (\text{\tt a},\text{\tt b}) \rangle
    14261426        """
    14271427        return '\\langle ' + \
    14281428               ', '.join([x._latex_() for x in self.gens()]) + ' \\rangle'
  • sage/groups/perm_gps/permgroup_element.pyx

    diff --git a/sage/groups/perm_gps/permgroup_element.pyx b/sage/groups/perm_gps/permgroup_element.pyx
    a b  
    590590           
    591591            sage: S = SymmetricGroup(['a', 'b'])
    592592            sage: latex(S.gens())
    593             \left[(\verb|a|,\verb|b|)\right]
     593            \left[(\text{\tt a},\text{\tt b})\right]
    594594        """
    595595        from sage.misc.latex import latex
    596596        return "".join(["(" + ",".join([latex(x) for x in cycle])+")" for cycle in self.cycle_tuples()])
  • sage/misc/latex.py

    diff --git a/sage/misc/latex.py b/sage/misc/latex.py
    a b  
    312312        sage: str_function('+34.5')
    313313        '+34.5'
    314314        sage: str_function('hello_world')
    315         '\\verb|hello_world|'
     315        '\\text{\\tt hello{\\char`\\_}world}'
    316316        sage: str_function('-1.00000?') # trac 12178
    317317        '-1.00000?'
    318318    """
     
    947947        sage: latex(FiniteField(25,'a'))
    948948        \Bold{F}_{5^{2}}
    949949        sage: latex("hello")
    950         \verb|hello|
     950        \text{\tt hello}
    951951        sage: LatexExpr(r"\frac{x^2 - 1}{x + 1} = x - 1")
    952952        \frac{x^2 - 1}{x + 1} = x - 1
    953953
     
    22962296        sage: t = PolynomialRing(QQ, 't').0
    22972297        sage: from sage.misc.latex import repr_lincomb
    22982298        sage: repr_lincomb(['a', 's', ''], [-t, t - 2, t^12 + 2])
    2299         '-t\\verb|a| + \\left(t - 2\\right)\\verb|s| + \\left(t^{12} + 2\\right)'
     2299        '-t\\text{\\tt a} + \\left(t - 2\\right)\\text{\\tt s} + \\left(t^{12} + 2\\right)'
    23002300        sage: repr_lincomb(['a', 'b'], [1,1])
    2301         '\\verb|a| + \\verb|b|'
     2301        '\\text{\\tt a} + \\text{\\tt b}'
    23022302
    23032303    Verify that a certain corner case works (see :trac:`5707` and
    23042304    :trac:`5766`)::
  • sage/modular/hecke/algebra.py

    diff --git a/sage/modular/hecke/algebra.py b/sage/modular/hecke/algebra.py
    a b  
    408408        EXAMPLES::
    409409
    410410            sage: latex(CuspForms(3, 24).hecke_algebra()) # indirect doctest
    411             \mathbf{T}_{\verb|Cuspidal|...Gamma0(3)...24...}
     411            \mathbf{T}_{\text{\tt Cuspidal...Gamma0(3)...24...}
    412412        """
    413413        from sage.misc.latex import latex
    414414        return "\\mathbf{T}_{%s}" % latex(self.__M)
  • sage/sets/set.py

    diff --git a/sage/sets/set.py b/sage/sets/set.py
    a b  
    252252        ::
    253253
    254254            sage: print latex(Primes())
    255             \verb|Set...of...all...prime...numbers:...|
     255            \text{\tt Set{ }of{ }all{ }prime{ }numbers:{ }2,{ }3,{ }5,{ }7,{ }...}
    256256            sage: print latex(Set([1,1,1,5,6]))
    257257            \left\{1, 5, 6\right\}
    258258        """