mathmaker.lib.machine package

Submodules

mathmaker.lib.machine.LaTeX module

class mathmaker.lib.machine.LaTeX.LaTeX(language, create_pic_files=True, **options)[source]

Bases: mathmaker.lib.machine.Structure.Structure

addvspace(height='30.0pt', **options)[source]

Add a vertical space.

create_table(size, content, **options)[source]

Write a table filled with the given content.

insert_dashed_hline(**options)[source]

Draw a horizontal dashed line.

insert_nonbreaking_space(**options)[source]

Insert a non-breaking space.

insert_picture(drawable_arg, **options)[source]

Draw and insert the picture of the drawable_arg.

insert_vspace(**options)[source]

Insert a vertical space (default height: 1 cm).

reset_exercises_counter()[source]

Write command reinitializing the exercises counter.

set_font_size_offset(arg)[source]

Set the font_size_offset field

set_redirect_output_to_str(arg)[source]

Set the redirect_output_to_str field to True or False

translate_font_size(arg)[source]

Turn the size keyword in markup language matching keyword.

type_string(objct, **options)[source]

Get the str version of objct. (Should be __str__())

write(given_string, **options)[source]

Write the given string.

write_document_begins(variant='default')[source]

Write “document begins” markup.

write_document_ends()[source]

Write the “end of document” command.

write_exercise_number()[source]

Write the command displaying “Exercise n°…”.

write_frame(content, uncovered=False, only=False, duration=None, numbering='')[source]

Write a slideshow’s frame to the output

Parameters:
  • content (str) – the frame’s content
  • uncovered (bool) – whether to split the content in several slides that will show one after the other. Mostly useful for title. The content’s parts must be delimited by SLIDE_CONTENT_SEP (from lib.constants).
  • only (bool) – whether to split the content in several slides that will show one after the other. Mostly useful for answers. The content’s parts must be delimited by SLIDE_CONTENT_SEP (from lib.constants). Difference with uncovered is the text will be replaced, not only made invisible.
  • duration (number (int or float)) – the duration of the frame. If it’s None, then no duration will be set.
Return type:

str

write_jump_to_next_page()[source]

Write the “jump to next page” command.

write_layout(size, col_widths, content, **options)[source]

Writes content arranged like in a table.

Param:

size: (nb of columns, nb of lines)

Parameters:
  • col_widths – list of int
  • content – list of str
write_math_style1(given_string)[source]

Write the given string as a math. expression (2d option)

write_math_style2(given_string, **kwargs)[source]

Write the given string as a mathematical expression.

write_new_line(check='', check2='', check3='', check4='')[source]

Write the “new line” command.

write_new_line_twice(**options)[source]

Write the “new line” command twice.

write_out(latex_document: str, pdf_output=False)[source]

Writes the given document to the output.

If pdf_output is set to True then the document will be compiled into a pdf and the pdf content will be written to output.

Parameters:
  • latex_document – contains the entire LaTeX document
  • pdf_output – if True, output will be written in pdf format
write_preamble(variant='default', required_pkg=None)[source]

Write the LaTeX document’s preamble.

write_set_font_size_to(arg)[source]

Write the command to set font size.

mathmaker.lib.machine.Structure module

class mathmaker.lib.machine.Structure.Structure(language)[source]

Bases: object

Abstract mother class of machine objects.

create_table(size, content, **options)[source]

Write a table filled with the given content.

insert_dashed_hline(**options)[source]

Draw a horizontal dashed line.

insert_nonbreaking_space(**options)[source]

Insert a non-breaking space.

insert_picture(drawable_arg, **options)[source]

Draw and insert the picture of the drawable_arg.

insert_vspace(**options)[source]

Insert a vertical space (default height: 1 cm).

reset_exercises_counter()[source]

Write command reinitializing the exercises counter.

set_font_size_offset(arg)[source]

Set the font_size_offset field

set_redirect_output_to_str(arg)[source]

Set the redirect_output_to_str field to True or False

translate_font_size(arg)[source]

Turn the size keyword in markup language matching keyword.

type_string(objct, **options)[source]

Get the str version of objct. (Should be __str__())

write(given_string, **options)[source]

Write the given string.

write_document_begins()[source]

Write “document begins” markup.

write_document_ends()[source]

Write the “end of document” command.

write_exercise_number()[source]

Write the command displaying “Exercise n°…”.

write_frame(content, uncovered=False, only=False, duration=None, numbering='')[source]

Write a frame to the output.

write_jump_to_next_page()[source]

Write the “jump to next page” command.

write_layout(size, col_widths, content, **options)[source]

Writes content arranged like in a table.

Param:

size: (nb of columns, nb of lines)

Parameters:
  • col_widths – list of int
  • content – list of str
write_math_style1(given_string)[source]

Write the given string as a math. expression (2d option)

write_math_style2(given_string)[source]

Write the given string as a mathematical expression.

write_new_line(**options)[source]

Write the “new line” command.

write_new_line_twice(**options)[source]

Write the “new line” command twice.

write_out(given_string, **options)[source]

Write to the current output.

write_preamble()[source]

Write the LaTeX document’s preamble.

write_set_font_size_to(arg)[source]

Write the command to set font size.

Module contents