mathmaker  0.6(alpha)
Public Member Functions | Public Attributes
machine.LaTeX.LaTeX Class Reference

This machine knows how to write LaTeX commands & math expressions. More...

Inheritance diagram for machine.LaTeX.LaTeX:
machine.Structure.Structure

List of all members.

Public Member Functions

def __init__
 Constructor The created machine is set to the beginning of an expression, its language is the default one (from cfg file or in case of any problem, from text.DEFAULT_LANGUAGE) its encoding is set to the default one (from cfg file or in case of any problem, from latex.DEFAULT_ENCODING)
def write_document_header
 Write the complete LaTeX header of the sheet to the output.
def write_document_begins
 Writes to the output the command to begin the document.
def write_document_ends
 Writes to the output the end of document command.
def write_exercise_number
 Writes to the output the command displaying an exercise's title.
def write_jump_to_next_page
 Writes to the output the jump to next page command.
def reset_exercises_counter
 Writes to the output the exercises counter reinitialize command.
def write_new_line
 Writes to the output the new line command.
def write_new_line_twice
 Writes to the output two commands writing two new lines.
def write_math_style2
 Prints the given string as a mathematical expression.
def write_math_style1
 Prints the given string as a mathematical expression.
def write
 Writes to the output the given string emphasize='bold'|'italics'|'underlined'.
def translate_font_size
 turn the size keyword in LaTeX matching keyword
def write_set_font_size_to
 Writes to the output the command setting the text size.
def write_layout
 Writes a table filled with the given [strings].
def type_string
 Creates a LaTeX string of the given object.
def insert_dashed_hline
 Draws a horizontal dashed line.
def insert_vspace
 Puts a vertical space (default 1 cm)
def insert_picture
 Draws and inserts the picture of the drawable_arg.
def set_font_size_offset
 Sets the font_size_offset field.
def set_redirect_output_to_str
 Sets the redirect_output_to_str field to True or False.

Public Attributes

 text_sizes
 font_size_offset
 create_pic_files
 encoding
 language
 language_code
 markup
 out
 redirect_output_to_str

Detailed Description

This machine knows how to write LaTeX commands & math expressions.

Todo:
When creating another machine, some things might have to change here

Definition at line 45 of file LaTeX.py.


Constructor & Destructor Documentation

def machine.LaTeX.LaTeX.__init__ (   self,
  language,
  options 
)

Constructor The created machine is set to the beginning of an expression, its language is the default one (from cfg file or in case of any problem, from text.DEFAULT_LANGUAGE) its encoding is set to the default one (from cfg file or in case of any problem, from latex.DEFAULT_ENCODING)

Parameters:
expression_beginsTrue if machine's at an expression's beginning
**optionsAny options
Returns:
One instance of machine.LaTeX
Todo:
The warning handling should be done in the main program

Definition at line 63 of file LaTeX.py.

References machine.LaTeX.LaTeX.create_pic_files, machine.LaTeX.LaTeX.encoding, machine.LaTeX.LaTeX.font_size_offset, machine.LaTeX.LaTeX.language, machine.LaTeX.LaTeX.language_code, machine.LaTeX.LaTeX.markup, machine.LaTeX.LaTeX.out, machine.LaTeX.LaTeX.redirect_output_to_str, and machine.LaTeX.LaTeX.text_sizes.


Member Function Documentation

def machine.LaTeX.LaTeX.translate_font_size (   self,
  arg 
)

turn the size keyword in LaTeX matching keyword

Warning:
if you chose a too low or too high value as font_size_offset,
then all the text will be either tiny or Huge.

Reimplemented from machine.Structure.Structure.

Definition at line 364 of file LaTeX.py.

References machine.LaTeX.LaTeX.font_size_offset, and machine.LaTeX.LaTeX.text_sizes.

Referenced by machine.LaTeX.LaTeX.write_document_header(), and machine.LaTeX.LaTeX.write_set_font_size_to().

Write the complete LaTeX header of the sheet to the output.

Reimplemented from machine.Structure.Structure.

Definition at line 127 of file LaTeX.py.

References machine.LaTeX.LaTeX.encoding, machine.LaTeX.LaTeX.language, machine.LaTeX.LaTeX.redirect_output_to_str, and machine.LaTeX.LaTeX.translate_font_size().

def machine.LaTeX.LaTeX.write_layout (   self,
  size,
  col_widths,
  content,
  options 
)

Writes a table filled with the given [strings].

Parameters:
size: (nb of lines, nb of columns)
col_widths: [int]
content: [strings] : borders='all' : unit='inch' etc. (check the possibilities...) def write_table(self, size, col_widths, content, **options): n_col = size[1] n_lin = size[0] result = "" center = "" new_line_sep = "\\\\" + "\n"

if 'center' in options: center = ">{\centering}" new_line_sep = "\\tabularnewline" + "\n"

if 'borders' in options and options['borders'] == 'all': v_border = "|" h_border = "\\hline \n" Writes content arranged like in a table. In the case of latex, it will just be the same.

Parameters:
size: (nb of lines, nb of columns)
col_widths: [int]
content: [strings] : borders=0|1|2|3... (not implemented yet) : unit='inch' etc. (check the possibilities...)

Reimplemented from machine.Structure.Structure.

Definition at line 461 of file LaTeX.py.

References machine.LaTeX.LaTeX.redirect_output_to_str.


The documentation for this class was generated from the following file: