Font Formatting

This module provides formatters to change the font and size of text.

class simpletex.formatting.font.Font(name: str, size: int = None, skip: int = None, inline: bool = False)

Bases: simpletex.core.Formatter

Changes the font face (and optionally the size) of text.

Imports the required packages fontspec and xltxtra upon instantiation. If used, the document must be processed with XeTeX or another font-aware TeX processor.

Create a new font formatter using the given font name and size.

name : str
The name of the font to use.
size : int
The font size to use, in pt. If size is None, the font size will not be changed.
skip : int
The line skip to use in pt. If skip is not provided, but size is specified, automatically calculate the skip according to skip = int(size*1.3).
inline : bool
If True, the inline (TeX directive) version of the formatter is used. Otherwise, use the command form.
class simpletex.formatting.font.SizeSelector(size: int, skip: int = None)

Bases: simpletex.core.Formatter

Changes the font size of text.

Allows specifying an optional skip parameter. Imports the required package anyfontsize on instantiation.

Create a new font size formatter with the given size and skip.

Automatically imports the required package anyfontsize.

size : int
The font size to use, in pt. If size is None, the formatter will do nothing.
skip : int
The line skip to use in pt. If skip is not provided, but size is specified, automatically calculate the skip according to skip = int(size*1.3).