# HG changeset patch
# User Jeroen Demeyer <jdemeyer@cage.ugent.be>
# Date 1324302231 0
# Node ID 5c85a106274748bdc69dd92585932f768b032c08
# Parent 12dbe7027b7b3dff43192ff7e069ba8363de2660
Additional changes to "latex" and "LatexExpr" documentation
diff git a/sage/misc/latex.py b/sage/misc/latex.py
a

b


371  371  
372  372  
373  373  class LatexExpr(str): 
374   """ 
 374  r""" 
375  375  A class for LaTeX expressions. 
376  376  
377  377  Normally, objects of this class are created by a :func:`latex` call. It is 
378  378  also possible to generate :class:`LatexExpr` directly from a string, which 
379   must contain a valid LaTeX code for typesetting in math mode. Strings are 
380   wrapped into verbatim environment for typeset output, while LaTeX 
381   expressions are left asis (see :func:`pretty_print`). 
 379  must contain valid LaTeX code for typesetting in math mode (without dollar 
 380  signs). In the Sage Notebook, use :func:`pretty_print` or the "Typeset" 
 381  checkbox to actually see the typeset LaTeX code. 
382  382  
383  383  INPUT: 
384  384  
385    anything convertible to a string of valid math mode LaTeX code. 
 385   ``str``  a string with valid math mode LaTeX code (or something 
 386  which can be converted to such a string). 
386  387  
387  388  OUTPUT: 
388  389  
… 
… 

410  411  x^{20} + 1 
411  412  sage: type(L) 
412  413  <class 'sage.misc.latex.LatexExpr'> 
 414  
 415  A ``LatexExpr`` can be converted to a plain string:: 
 416  
 417  sage: str(latex(x^20 + 1)) 
 418  'x^{20} + 1' 
413  419  """ 
414  420  def __add__(self, other): 
415  421  r""" 
… 
… 

763  769  
764  770  :: 
765  771  
766   %latex 
767   The equation $y^2 = x^3 + x$ defines an elliptic curve. 
768   We have $2006 = \sage{factor(2006)}$. 
769   
 772  %latex 
 773  The equation $y^2 = x^3 + x$ defines an elliptic curve. 
 774  We have $2006 = \sage{factor(2006)}$. 
770  775  
771  776  in an input cell in the notebook to get a typeset version. Use 
772  777  ``%latex_debug`` to get debugging output. 
773  778  
774   Use ``latex(...)`` to typeset a Sage object. 
 779  Use ``latex(...)`` to typeset a Sage object. Use :class:`LatexExpr` 
 780  to typeset LaTeX code that you created by hand. 
775  781  
776  782  Use ``%slide`` instead to typeset slides. 
777  783  
… 
… 

780  786  You must have dvipng (or dvips and convert) installed 
781  787  on your operating system, or this command won't work. 
782  788  
 789  EXAMPLES:: 
 790  
 791  sage: latex(x^20 + 1) 
 792  x^{20} + 1 
 793  sage: latex(FiniteField(25,'a')) 
 794  \Bold{F}_{5^{2}} 
 795  sage: latex("hello") 
 796  \verbhello 
 797  sage: LatexExpr(r"\frac{x^2  1}{x + 1} = x  1") 
 798  \frac{x^2  1}{x + 1} = x  1 
 799  
 800  LaTeX expressions can be added, note that a space is automatically 
 801  added:: 
 802  
 803  sage: LatexExpr(r"y \neq") + latex(x^20 + 1) 
 804  y \neq x^{20} + 1 
783  805  """ 
784  806  def __init__(self, debug=False, slide=False, density=150, pdflatex=None, engine=None): 
785  807  self.__debug = debug 