mff_pytex package#

Subpackages#

Submodules#

mff_pytex.bib module#

Utilities for bibliography.

class mff_pytex.bib.Article(name: str, title: str, year: int, author: str, journal: str, month: Optional[str] = None, note: Optional[str] = None, number: Optional[int] = None, pages: Optional[str] = None, volume: Optional[str] = None)#

Bases: Bib

An article from a magazine or a journal.

author: str#
journal: str#
month: Optional[str] = None#
note: Optional[str] = None#
number: Optional[int] = None#
pages: Optional[str] = None#
title: str#
volume: Optional[str] = None#
year: int#
class mff_pytex.bib.Bib(name: str)#

Bases: object

Abstract class for bibliography.

name: str#
class mff_pytex.bib.Bibliography(file_name: str)#

Bases: File

Bib file

Note

Requires natbib package to import, added with autopackage management.

add(*bibs: Bib) None#

Adds a book, etc. to the list of bibliohraphy.

Parameters

*bibs (Bib) – A Bib object

bib_list: List[Bib] = []#
create(mode: str = 'w+') None#

Creates .bib file

Parameters

mode (str, optional) – Mode of given file. Same as open() function. Defaults to ‘w+’

file_type: str = 'bib'#
class mff_pytex.bib.Book(name: str, title: str, year: int, author: str, publisher: str, address: Optional[str] = None, edition: Optional[str] = None, editor: Optional[str] = None, month: Optional[str] = None, note: Optional[str] = None, number: Optional[int] = None, series: Optional[str] = None, volume: Optional[str] = None)#

Bases: Bib

A published book

address: Optional[str] = None#
author: str#
edition: Optional[str] = None#
editor: Optional[str] = None#
month: Optional[str] = None#
note: Optional[str] = None#
number: Optional[int] = None#
publisher: str#
series: Optional[str] = None#
title: str#
volume: Optional[str] = None#
year: int#
class mff_pytex.bib.Booklet(name: str, title: str, author: Optional[str] = None, howpublished: Optional[str] = None, year: Optional[int] = None, month: Optional[str] = None, note: Optional[str] = None)#

Bases: Bib

A bound work without a named publisher or sponsor.

author: Optional[str] = None#
howpublished: Optional[str] = None#
month: Optional[str] = None#
note: Optional[str] = None#
title: str#
year: Optional[int] = None#
class mff_pytex.bib.Conference(name: str, author: str, title: str, booktitle: str, year: int, editor: Optional[str] = None, number: Optional[int] = None, volume: Optional[str] = None, series: Optional[str] = None, address: Optional[str] = None, page: Optional[str] = None, month: Optional[str] = None, organization: Optional[str] = None, publisher: Optional[str] = None, note: Optional[str] = None)#

Bases: Bib

Equal to inproceedings

address: Optional[str] = None#
author: str#
booktitle: str#
editor: Optional[str] = None#
month: Optional[str] = None#
note: Optional[str] = None#
number: Optional[int] = None#
organization: Optional[str] = None#
page: Optional[str] = None#
publisher: Optional[str] = None#
series: Optional[str] = None#
title: str#
volume: Optional[str] = None#
year: int#
class mff_pytex.bib.InBook(name: str, title: str, year: int, author: str, publisher: str, pages: str, chapter: Optional[str] = None, address: Optional[str] = None, edition: Optional[str] = None, editor: Optional[str] = None, month: Optional[str] = None, note: Optional[str] = None, number: Optional[int] = None, series: Optional[str] = None, volume: Optional[str] = None)#

Bases: Bib

A section of a book without its own title.

address: Optional[str] = None#
author: str#
chapter: Optional[str] = None#
edition: Optional[str] = None#
editor: Optional[str] = None#
month: Optional[str] = None#
note: Optional[str] = None#
number: Optional[int] = None#
pages: str#
publisher: str#
series: Optional[str] = None#
title: str#
volume: Optional[str] = None#
year: int#
class mff_pytex.bib.InCollection(name: str, author: str, title: str, booktitle: str, year: int, publisher: str, editor: Optional[str] = None, number: Optional[int] = None, volume: Optional[str] = None, series: Optional[str] = None, typ: Optional[str] = None, chapter: Optional[str] = None, pages: Optional[str] = None, address: Optional[str] = None, edition: Optional[str] = None, month: Optional[str] = None, note: Optional[str] = None)#

Bases: Bib

A section of a book having its own title.

address: Optional[str] = None#
author: str#
booktitle: str#
chapter: Optional[str] = None#
edition: Optional[str] = None#
editor: Optional[str] = None#
month: Optional[str] = None#
note: Optional[str] = None#
number: Optional[int] = None#
pages: Optional[str] = None#
publisher: str#
series: Optional[str] = None#
title: str#
typ: Optional[str] = None#
volume: Optional[str] = None#
year: int#
class mff_pytex.bib.InProceedings(name: str, author: str, title: str, booktitle: str, year: int, editor: Optional[str] = None, number: Optional[int] = None, volume: Optional[str] = None, series: Optional[str] = None, address: Optional[str] = None, page: Optional[str] = None, month: Optional[str] = None, organization: Optional[str] = None, publisher: Optional[str] = None, note: Optional[str] = None)#

Bases: Conference

An article in a conference proceedings.

author: str#
booktitle: str#
name: str#
title: str#
year: int#
class mff_pytex.bib.Manual(name: str, title: str, author: Optional[str] = None, organization: Optional[str] = None, address: Optional[str] = None, edition: Optional[str] = None, month: Optional[str] = None, year: Optional[int] = None, note: Optional[str] = None)#

Bases: Bib

Technical manual.

address: Optional[str] = None#
author: Optional[str] = None#
edition: Optional[str] = None#
month: Optional[str] = None#
note: Optional[str] = None#
organization: Optional[str] = None#
title: str#
year: Optional[int] = None#
class mff_pytex.bib.MasterThesis(name: str, author: str, title: str, school: str, year: int, typ: Optional[str] = None, address: Optional[str] = None, month: Optional[str] = None, note: Optional[str] = None)#

Bases: Bib

Master’s thesis.

address: Optional[str] = None#
author: str#
month: Optional[str] = None#
note: Optional[str] = None#
school: str#
title: str#
typ: Optional[str] = None#
year: int#
class mff_pytex.bib.Misc(name: str, author: Optional[str] = None, title: Optional[str] = None, howpublished: Optional[str] = None, month: Optional[str] = None, year: Optional[int] = None, note: Optional[str] = None)#

Bases: Bib

Template useful for other kinds of publication.

author: Optional[str] = None#
howpublished: Optional[str] = None#
month: Optional[str] = None#
note: Optional[str] = None#
title: Optional[str] = None#
year: Optional[int] = None#
class mff_pytex.bib.PhdThesis(name: str, author: str, title: str, school: str, year: int, typ: Optional[str] = None, address: Optional[str] = None, month: Optional[str] = None, note: Optional[str] = None)#

Bases: MasterThesis

Ph.D. thesis.

author: str#
name: str#
school: str#
title: str#
year: int#
class mff_pytex.bib.Proceedings(name: str, title: str, year: int, editor: Optional[str] = None, number: Optional[int] = None, volume: Optional[str] = None, series: Optional[str] = None, address: Optional[str] = None, month: Optional[str] = None, organization: Optional[str] = None, publisher: Optional[str] = None, note: Optional[str] = None)#

Bases: Bib

The proceedings of a conference.

address: Optional[str] = None#
editor: Optional[str] = None#
month: Optional[str] = None#
note: Optional[str] = None#
number: Optional[int] = None#
organization: Optional[str] = None#
publisher: Optional[str] = None#
series: Optional[str] = None#
title: str#
volume: Optional[str] = None#
year: int#
class mff_pytex.bib.TechReport(name: str, author: str, title: str, institution: str, year: int, typ: Optional[str] = None, number: Optional[int] = None, address: Optional[str] = None, month: Optional[str] = None, note: Optional[str] = None)#

Bases: Bib

Technical report from educational, commercial or standardization institution.

address: Optional[str] = None#
author: str#
institution: str#
month: Optional[str] = None#
note: Optional[str] = None#
number: Optional[int] = None#
title: str#
typ: Optional[str] = None#
year: int#
class mff_pytex.bib.Unpublished(name: str, author: str, title: str, note: str, month: Optional[str] = None, year: Optional[int] = None)#

Bases: Bib

An unpublished article, book, thesis, etc.

author: str#
month: Optional[str] = None#
note: str#
title: str#
year: Optional[int] = None#

mff_pytex.exceptions module#

exception mff_pytex.exceptions.WrongTypeListError(message: str = 'Wrong type of iterable. You probably use dictionay istead of Sequence.')#

Bases: Exception

Raised when wrong type of iterable was used in List class.

mff_pytex.images module#

Utilities for using images, graphs etc. in text.

class mff_pytex.images.Picture(picture_path: str, *params: str, caption: Optional[str] = None, label: Optional[str] = None, settings: Optional[list] = None)#

Bases: Environment

Picture environment for including pictures, graphs etc.

mff_pytex.packages module#

Predefined packages to use, if you want to use specific modules in MFF Pytex

class mff_pytex.packages.Package(name: str, *params: str)#

Bases: object

Package class for adding packages to tex file.

mff_pytex.packages.add_package(*packages: Package) None#

Adds packages to package_list

Parameters

*packages (Package) – packages to add.

mff_pytex.packages.clear_packages() None#

Clears package_list

mff_pytex.packages.find_package(package: Package) bool#

Find package in package_list

Parameters

package (Package) –

Returns

bool

mff_pytex.packages.get_packages() List[Package]#

Returns package_list

Returns

package_list

Return type

list[Package]

mff_pytex.packages.package_list: List[Package] = []#

Package_list contains all packages used in tex document.

mff_pytex.structure module#

Module containing basic structure of file.

class mff_pytex.structure.Document#

Bases: Environment

Content of document.

bibliography(name: str) None#

Adds a bibliography command to the TeX file.

Parameters

name (str) – Name of a bib file

clearpage() None#

Adds a clearpage command to the TeX file.

listoffigures() None#

Adds a listoffigures command to the TeX file.

listoftables() None#

Adds a listoftables command to the TeX file.

maketitle() None#

Adds a maketitle command to the TeX file.

newpage() None#

Adds a newpage command to the TeX file.

tableofcontents() None#

Adds a tableofcontents command to the TeX file.

class mff_pytex.structure.DocumentClass(name: str, *params: str)#

Bases: object

Document class command.

class mff_pytex.structure.Preamble(documentclass: ~mff_pytex.structure.DocumentClass = <mff_pytex.structure.DocumentClass object>, author: ~typing.Optional[str] = None, title: ~typing.Optional[str] = None, date: ~typing.Optional[~datetime.date] = None)#

Bases: Writing

Preamble contains basic info about author and document.

author: Optional[str] = None#
date: Optional[date] = None#
documentclass: DocumentClass = <mff_pytex.structure.DocumentClass object>#
title: Optional[str] = None#
class mff_pytex.structure.TexFile(file_name: str)#

Bases: File

TeX file.

create(mode: str = 'w+') None#

Creates file and writes its content.

Parameters

mode (str, optional) – Mode of given file. Same as open() function. Defaults to ‘w+’

document: Document = <mff_pytex.structure.Document object>#
file_type: str = 'tex'#
make_pdf(mode: str = 'r') None#

Creates pdf file, if neccessary writes its content and create pdf document.

Parameters

mode (str, optional) – mode of given file. Same as open() function. Defaults to ‘r’.

preamble: Preamble = Preamble(documentclass=<mff_pytex.structure.DocumentClass object>, author=None, title=None, date=None)#

mff_pytex.tables module#

Tables and lists utilities and support for pandas dataframe.

class mff_pytex.tables.List(arr: Union[Sequence, dict], en_type: str = 'itemize')#

Bases: Environment

List structure. Convert python lists to TeX lists.

item(content: str, label: Optional[str] = None)#

Add one item in content.

Parameters
  • content (str) – Main text.

  • label (str) – Label of item.

items(arr: Union[Sequence, dict]) None#

Includes given Sequence of dictionary in content.

Parameters
  • arr (Sequence | Dict) – Sequence which is iterated. Only dictionary is compactible with ‘descrition’.

  • en_type (str) – Type of list

class mff_pytex.tables.Table(dataframe: DataFrame, **styles: Any)#

Bases: object

Table structure. Converts pandas’ dataframe to TeX table. .. note:: Requires booktabs package to import, added with autopackage management.

df#

Dataframe containing table.

Type

DataFrame

styles#

Contains parameters for to_latex method of DataFrame. More info in pandas docs.

mff_pytex.utils module#

Basic utils for work with LaTeX documents.

class mff_pytex.utils.Environment(en_type: str, *params: str)#

Bases: Writing

Basic environment structure.

en_type#

Type of environment

Type

str

_text#

Content of environment,

Type

str

class mff_pytex.utils.File(file_name: str)#

Bases: object

Abstract class for generating files.

file_name: str#
file_path: str#
file_type: str#
class mff_pytex.utils.Writing#

Bases: object

add(environment: Any) None#

Writes environment to the TeX file.

Parameters

environment (Any) – Figure to use.

math(formula: str) None#

Add math formula to the TeX file.

Parameters

formula (str) – Used formula

write(*lines: Optional[str]) None#

Write multiple lines to the TeX file.

Parameters

*lines (str) – Lines of text intended for insert to content.

mff_pytex.utils.command(comm: str, main: Optional[str] = None, *params) str#

Template for creating commands.

If main is None, than return ‘command’. If main is not none, but any optional parameter given, than return ‘command{main}’ If main and optional parameters given, than return ‘command[param1, param2, …]{main}’

Parameters
  • comm (str) – Name of command

  • main (str| None, optional) – Main parameter of command, defaults to None.

  • *params (str) – Optional parameters of command

Returns

string of given command by given parameters.

Return type

str

mff_pytex.utils.doublecommand(comm: str, main: str, second: Optional[str] = None, opt: bool = False) str#

Template for creating doublecommands.

Commands lokks like this comm{main} {second}

Parameters
  • comm (str) – Name of command

  • main (str) – First parameter

  • second (str | None, optional) – Second parameter

  • opt (bool, optional) – Set if the second parameter is optional. Defaults None

Returns

string of given command by given parameters.

Return type

str

mff_pytex.utils.get_dir() str#

Returns directory where main file has been executed.

Returns

Directory name where is main file

Return type

str

mff_pytex.utils.get_func_name() str#

Utility that returns name of function.

Returns

Name of function.

Return type

str

mff_pytex.utils.get_path() str#

Returns path to main file.

Returns

Path to main file

Return type

str

Module contents#

Top-level package for MFF PyTeX.