Equations and Mathematics¶
This module provides formatters to create and display LaTeX equations.
-
class
simpletex.math.
Equation
(inline: bool = True)¶ Bases:
simpletex.core.Formatter
Formats text as a LaTeX equation.
Initialize an empty equation.
- inline : bool
- Chooses the equation format to use.
If
True
, use the inline ($
) syntax. IfFalse
, use the display-style ($$
) syntax.
-
class
simpletex.math.
Add
¶ Bases:
simpletex.math.Operator
Adds arguments together in symbolic form.
Initialize an empty addition operator.
-
class
simpletex.math.
Subtract
(inline: bool = False)¶ Bases:
simpletex.math.Operator
Subtracts two given arguments in symbolic form.
Initialize an empty subtraction operator.
-
class
simpletex.math.
Multiply
(symbol='dot')¶ Bases:
simpletex.math.Operator
Multiplies arguments together in symbolic form.
Initialize an empty multiplication operator.
- symbol : str or None
- Chooses the multiplication symbol to use.
If
None
, no explicit symbol is used. If ‘.’ or ‘dot’, a dot-style (\cdot
) operator is used. If ‘x’, ‘cross’, or ‘times’, a cross-style (\times
) operator is used. If ‘*’ or ‘star’, a star-style (*
) operator is used.
-
class
simpletex.math.
Divide
(inline: bool = False)¶ Bases:
simpletex.math.Operator
Divides two given arguments in symbolic form.
Initialize an empty division operator.
- inline : bool
- Chooses division format to use.
If
False
, use the display-style (\frac{}{}
) syntax. IfTrue
, use the inline (/
) syntax.
-
class
simpletex.math.
Matrix
(brackets: str = '[')¶ Bases:
simpletex.base.Environment
Represents a matrix.
Can be contstructed either with nested lists or a 2D numpy array. Numpy is not requred.
Create a new empty matrix.
The type of brackets to use can be specified. Automatically imports the required package
amsmath
.- brackets : str
- Type of brackets to use.
Supported options are
''
(no brackets),'('
,'['
,'{'
,'|'
, and'||'
.