# HG changeset patch
# User Franco Saliola <saliola@gmail.com>
# Date 1304874234 14400
# Node ID cacdbf288bd0d6e237912613e19c04ac3517f4fc
# Parent f8bdf65336cfdc59771dca5141e5b96d72c1d57b
trac 11315: remove pstricks from default latex preamble
diff --git a/sage/misc/latex.py b/sage/misc/latex.py
|
a
|
b
|
special method ``_latex_(self)`` that re |
| 25 | 25 | |
| 26 | 26 | EMBEDDED_MODE = False |
| 27 | 27 | |
| 28 | | COMMON_HEADER='\\usepackage{amsmath}\n\\usepackage{amssymb}\n\\usepackage{amsfonts}\\usepackage{graphicx}\\usepackage{pstricks}\\pagestyle{empty}\n\\usepackage[utf8]{inputenc}\\usepackage[T1]{fontenc}\n' |
| 29 | | |
| 30 | | LATEX_HEADER='\\documentclass{article}' + COMMON_HEADER + '\\oddsidemargin 0.0in\n\\evensidemargin 0.0in\n\\textwidth 6.45in\n\\topmargin 0.0in\n\\headheight 0.0in\n\\headsep 0.0in\n\\textheight 9.0in\n' |
| 31 | | |
| 32 | | SLIDE_HEADER='\\documentclass[a0,8pt]{beamer}' + COMMON_HEADER + '\\textwidth=1.1\\textwidth\\textheight=2\\textheight\n' |
| 33 | | |
| 34 | | #SLIDE_HEADER='\\documentclass[landscape]{slides}\\usepackage{fullpage}\\usepackage{amsmath}\n\\usepackage{amssymb}\n\\usepackage{amsfonts}\\usepackage{graphicx}\usepackage{pstricks}\pagestyle{empty}\n' |
| | 28 | COMMON_HEADER='\\usepackage{amsmath}\n\\usepackage{amssymb}\n\\usepackage{amsfonts}\n\\usepackage{graphicx}\n\\pagestyle{empty}\n\\usepackage[utf8]{inputenc}\n\\usepackage[T1]{fontenc}\n' |
| | 29 | |
| | 30 | LATEX_HEADER='\\documentclass{article}\n' + COMMON_HEADER + '\\oddsidemargin 0.0in\n\\evensidemargin 0.0in\n\\textwidth 6.45in\n\\topmargin 0.0in\n\\headheight 0.0in\n\\headsep 0.0in\n\\textheight 9.0in\n' |
| | 31 | |
| | 32 | SLIDE_HEADER='\\documentclass[a0,8pt]{beamer}\n' + COMMON_HEADER + '\\textwidth=1.1\\textwidth\n\\textheight=2\\textheight\n' |
| 35 | 33 | |
| 36 | 34 | import shutil, re |
| 37 | 35 | import os.path |
| … |
… |
def view(objects, title='SAGE', debug=Fa |
| 1822 | 1820 | sage: view(3, mode='display') |
| 1823 | 1821 | <html><div class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</div></html> |
| 1824 | 1822 | sage: sage.misc.latex.EMBEDDED_MODE = False |
| | 1823 | |
| | 1824 | TESTS:: |
| | 1825 | |
| | 1826 | sage: from sage.misc.latex import _run_latex_, _latex_file_ |
| | 1827 | sage: g = sage.misc.latex.latex_examples.graph() |
| | 1828 | sage: latex.add_to_preamble(r"\usepackage{tkz-graph}") |
| | 1829 | sage: file = os.path.join(SAGE_TMP, "temp.tex") |
| | 1830 | sage: O = open(file, 'w'); O.write(_latex_file_(g)); O.close() |
| | 1831 | sage: _run_latex_(file, engine="pdflatex") # optional - latex |
| | 1832 | 'pdf' |
| | 1833 | |
| 1825 | 1834 | """ |
| 1826 | 1835 | if isinstance(objects, LatexExpr): |
| 1827 | 1836 | s = str(objects) |
| … |
… |
and try again from the notebook -- you s |
| 2422 | 2431 | """ |
| 2423 | 2432 | return """LaTeX example for testing display of pstricks output. |
| 2424 | 2433 | |
| 2425 | | To use, view this object. It should work okay from the command |
| 2426 | | line but not from the notebook. In the notebook, run |
| 2427 | | 'latex.add_to_jsmath_avoid_list("pspicture")' and try again -- you |
| 2428 | | should get a picture (of forces acting on a mass on a pendulum).""" |
| | 2434 | To use, first try calling 'view' on this object -- you |
| | 2435 | should get gibberish. Now, make sure that you have the most |
| | 2436 | recent version of the TeX package pstricks installed. Run |
| | 2437 | 'latex.add_to_preamble("\\usepackage{pstricks}")' and try |
| | 2438 | viewing it again. From the command line, this should pop |
| | 2439 | open a nice window with a picture of forces acting on a mass |
| | 2440 | on a pendulum. In the notebook, you should get an error. |
| | 2441 | Finally, run |
| | 2442 | 'latex.add_to_jsmath_avoid_list("pspicture")' and try again |
| | 2443 | -- you should get a nice picture.""" |
| 2429 | 2444 | |
| 2430 | 2445 | def _latex_(self): |
| 2431 | 2446 | """ |