Table of contents Index

Module PyLaTeX.LaTeX

Declared in module PyLaTeX

class LaTeXError(Exception)
class LaTeXIOError(IOError)
class _LaTeX_
def open(file=None)
string BibTeX_Command = 'bibtex %s'
string LaTeX_Command = "latex '\\nonstopmode\\input{%s}'"
string __author__ = 'Berthold H\366llmann, bhoel@starship.python.net'
string __file__ = '../PyLaTeX/LaTeX.pyc'
string __version__ = '1.11'
list article = ['article', 'aguplus', 'amsart', 'ltugboat', 'ltugproc', 'ltxdoc', ...]
list book = ['book', 'amsbook', 'amsdtx', 'amsldoc', 'scrbook']
string endl = '\012'
list letter = ['letter', 'akletter', 'dinbrief', 'iletter', 'myletter', 'script_l', ...]
list misc = ['amsproc', 'exam', 'foils', 'ieeetrans', 'journal', 'minimal', ...]
list report = ['report', 'scrrep', 'refrep', 'scrreprt']

Description

LaTeX mode for python:

Write a LaTeX2e file and compile it with makeindex and bibtex.

The main class of LaTeX is the class _LaTeX_, which is usually instantiated using the PyLaTeX.LaTeX.open(...) command. open returns an instance of _LaTeX_ which has the following methods:

open(file = None)
Open the file named file as output file. If no name is given for file, a temporary filename is generated.
close()
Close the generated file (and actually write it)
doc_class(name, option=None)
Name the document class for the LaTeX file to write. It is possible to give an option string to option.
package(name, option=None)
Add a \usepackage line for name and add the options named by option. Multiple calls of package with different options are allowed, but only the options from the last call are used.
preamble(data = "")
Add data to the LaTeX preamble (the part before \begin{dcoument}). This is usefull for \newcommands and similar. Calls of package or preamble may occur at any position in the python command order. They are moved to the top of the LaTeX file.
toc
Insert the table of contents
lof
Insert the list of figures.
lot
Insert the list of tables.
part(full, short=None, label=None)
Start a new part named full. Optionally you can insert a short name a label.
chapter(full, short=None, label=None)
Start a new chapter.
section(full, short=None, label=None)
Start a new section.
subsection(full, short=None, label=None)
Start a new subsection.
subsubsection(full, short=None, label=None)
Start a new subsubsection.
paragraph(full, short=None, label=None)
Start a new paragraph.
subparagraph(full, short=None, label=None)
Start a new subparagraph.
compile()
Start LaTeX on the generated output file as often as needed to resolve all references. Also bibtex is called when needed. If the close method is not called yet, compile calls it to genereate the LaTeX file.
dvips()
Generate a PostScript file from the generated dvi file.
write(data = "")
Add content to the LaTeX file. data will be put between \begin{document} and \end{document} in the order of the write calls.
equation(content, label=None)
Insert the equation defined in content and generate the label label.
image(file, options=None, caption=None, shortcap=None, label=None)
Add a eps image using thze graphicx package. Qne can add an option string using options, a caption caption with a short caption shortcap and a label label for crossreference.
ref(label)
Insert a crossreference to the label label.
file()
Return the filename, which will be written by close.

There is one Attribute visable to the user:

BoxedPics
If a test on BoxedPics is true, a \fbox is generated around each included image.

There are some custiomizable variables in this module:

LaTeX_Command
The command string used to call the LaTeX command. Must contain exactly one %s to be replaced by the name of the generated file.
BibTeX_Command
The command string used to call the bibtex command. Must contain exactly one %s to be replaced by the name of the .aux file for the generated file.

There is also a Lists of avaible classes. I did a seach for all .cls files on my system and checked all files for a \LoadClass{X} statement. If I found one, I added this class to X else to misc:

article
article like classes.
report
report like classes.
book
book like classes.
letter
letter like classes.
misc
Classes I could not classify.

Author: Berthold H\366llmann
Version: 1.11