Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
be.ugent.caagt.jmathtex.TeXFormula
public class TeXFormula
extends java.lang.Object
TeXIcon
from it and painting it) using algorithms that are based on the
TeX algorithms.
These formula's can be built using the built-in primitive TeX parser
(methods with String arguments) or using other TeXFormula objects. Most methods
have (an) equivalent(s) where one or more TeXFormula arguments are replaced with
String arguments. These are just shorter notations, because all they do is parse
the string(s) to TeXFormula's and call an equivalent method with (a) TeXFormula argument(s).
Most methods also come in 2 variants. One kind will use this TeXFormula to build
another mathematical construction and then change this object to represent the newly
build construction. The other kind will only use other
TeXFormula's (or parse strings), build a mathematical construction with them and
insert this newly build construction at the end of this TeXFormula.
Because all the provided methods return a pointer to this (modified) TeXFormula
(except for the createTeXIcon method that returns a TeXIcon pointer),
method chaining is also possible.
Important: All the provided methods modify this TeXFormula object, but all the
TeXFormula arguments of these methods will remain unchanged and independent of
this TeXFormula object!
Constructor Summary | |
| |
| |
| |
|
Method Summary | |
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXIcon |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
static TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
TeXFormula |
|
protected static final float PREC
- Field Value:
- 0.0f
protected be.ugent.caagt.jmathtex.Atom root
public TeXFormula()
Creates an empty TeXFormula.
public TeXFormula(Listl)
Creates a new TeXFormula from a list of TeXFormula objects. If the list is empty (or null), then an empty TeXFormula will be created. Otherwise, the newly created TeXFormula is the same as if all the TeXFormula's in the list were added one after another (starting with the first one) to an empty TeXFormula using theadd(TeXFormula)
method. The new TeXFormula is independent of all the TeXFormula's from the list!
- Parameters:
l
- a list of TeXFormula objects
public TeXFormula(String s) throws ParseException
Creates a new TeXFormula by parsing the given string (using a primitive TeX parser).
- Parameters:
s
- the string to be parsed
- Throws:
ParseException
- if the string could not be parsed correctly
public TeXFormula(TeXFormula f)
Creates a new TeXFormula that is a copy of the given TeXFormula. Both TeXFormula's are independent of one another!
- Parameters:
f
- the formula to be copied
public TeXFormula add(String s) throws ParseException
Parses the given string and inserts the resulting formula at the end of the current TeXFormula.
- Parameters:
s
- the string to be parsed and inserted
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the string could not be parsed correctly
public TeXFormula add(TeXFormula f)
Inserts the given TeXFormula at the end of the current TeXFormula.
- Parameters:
f
- the TeXFormula to be inserted
- Returns:
- the modified TeXFormula
public TeXFormula addAcc(String s, String accentName) throws InvalidSymbolTypeException, SymbolNotFoundException, ParseException
Parses the given string(s) into a TeXFormula, puts the given accent above it and inserts the result at the end of the current TeXFormula.
- Parameters:
s
- the string to be parsed into a TeXFormula above which te given accent will be placedaccentName
- the name of the accent symbol
- Returns:
- the modified TeXFormula
- Throws:
InvalidSymbolTypeException
- if the symbol is not defined as an accentSymbolNotFoundException
- if there's no symbol defined with the given nameParseException
- if the string(s) could not be parsed correctly
public TeXFormula addAcc(TeXFormula base, String accentName) throws InvalidSymbolTypeException, SymbolNotFoundException
Puts the given accent above the given TeXFormula and inserts the result at the end of the current TeXFormula.
- Parameters:
base
- the TeXFormula above which the given accent will be placedaccentName
- the name of the accent symbol
- Returns:
- the modified TeXFormula
- Throws:
InvalidSymbolTypeException
- if the symbol is not defined as an accentSymbolNotFoundException
- if there's no symbol defined with the given name
public TeXFormula addAcc(TeXFormula base, TeXFormula accent) throws InvalidSymbolTypeException, InvalidTeXFormulaException
Puts the given accent TeXFormula (that must represent a single accent symbol!) above the given base TeXFormula and inserts the result at the end of the current TeXFormula. It's recommended to use one of the other more simple "addAcc"-mehods that require the symbolname of the accent as a string! This method was added only because it was the best way for parsing the MathML "mover" element into a TeXFormula.
- Parameters:
base
- the TeXFormula above which the given accent will be placedaccent
- the TeXFormula that must represent a single accent symbol
- Returns:
- the modified TeXFormula
- Throws:
InvalidSymbolTypeException
- if the symbol that the given accent TeXFormula represents, is not defined as an accentInvalidTeXFormulaException
- if the given accent TeXFormula does not represent a single symbol
public TeXFormula addEmbraced(String s, String left, String right) throws SymbolNotFoundException, ParseException, InvalidDelimiterException
Parses the given string(s) into a TeXFormula, surrounds it with the given delimiters (if not null) and inserts the result at the end of the current TeXFormula.
- Parameters:
s
- the string to be parsed into a TeXFormula that will be surrounded by the given delimitersleft
- the symbol name of the left delimiter (or null: no delimiter)right
- the symbol name of the right delimiter (or null: no delimiter)
- Returns:
- the modified TeXFormula
- Throws:
SymbolNotFoundException
- if no symbol is defined for one of the given namesParseException
- if the string(s) could not be parsed correctlyInvalidDelimiterException
- if one of the symbols is not defined as a delimiter symbol
public TeXFormula addEmbraced(String s, char l, char r) throws SymbolNotFoundException, InvalidDelimiterException, ParseException, DelimiterMappingNotFoundException
Parses the given string into a TeXFormula, surrounds it with the given delimiters and inserts the result at the end of the current TeXformula.
- Parameters:
s
- the string to be parsed into a TeXFormula that will be surrounded by the given delimitersl
- the left delimiter characterr
- the right delimiter character
- Returns:
- the modified TeXFormula
- Throws:
SymbolNotFoundException
- if one of the delimiter characters is mapped to an unknown symbolInvalidDelimiterException
- if one of the delimiter characters is mapped to a symbol that is not defined as a delimiter symbolParseException
- if the string could not be parsed correctlyDelimiterMappingNotFoundException
- if no character-to-symbol mapping is found for one of the delimiter characters
public TeXFormula addEmbraced(TeXFormula f, String left, String right) throws SymbolNotFoundException, InvalidDelimiterException
Surrounds the given TeXFormula with the given delimiters (if not null) and inserts the result at the end of the current TeXFormula.
- Parameters:
f
- the TeXFormula that will be surrounded by the given delimitersleft
- the symbol name of the left delimiter (or null: no delimiter)right
- the symbol name of the right delimiter (or null: no delimiter)
- Returns:
- the modified TeXFormula
- Throws:
SymbolNotFoundException
- if no symbol is defined for one of the given namesInvalidDelimiterException
- if one of the symbols is not defined as a delimiter symbol
public TeXFormula addEmbraced(TeXFormula f, char l, char r) throws SymbolNotFoundException, InvalidDelimiterException, DelimiterMappingNotFoundException
Surrounds the given TeXFormula with the given delimiters and inserts the result at the end of the current TeXformula.
- Parameters:
f
- the TeXFormula that will be surrounded by the given delimitersl
- the left delimiter characterr
- the right delimiter character
- Returns:
- the modified TeXFormula
- Throws:
SymbolNotFoundException
- if one of the delimiter characters is mapped to an unknown symbolInvalidDelimiterException
- if one of the delimiter characters is mapped to a symbol that is not defined as a delimiter symbolDelimiterMappingNotFoundException
- if no character-to-symbol mapping is found for one of the delimiter characters
public TeXFormula addFraction(String num, String denom, boolean rule) throws ParseException
Parses the given strings into TeXFormula's that will represent the numerator (num) and the denominator (denom) of a fraction, draws a line between them depending on "rule" and inserts the result at the end of the current TeXFormula.
- Parameters:
num
- the string to be parsed into a TeXFormula that will represent the numerator of the fractiondenom
- the string to be parsed into a TeXFormula that will represent the denominator of the fractionrule
- whether a line should be drawn between numerator and denominator
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if one of the strings could not be parsed correctly
public TeXFormula addFraction(String num, String denom, boolean rule, int numAlign, int denomAlign) throws ParseException
Parses the given strings into TeXFormula's that will represent the numerator (num) and denominator (denom) of a fraction, draws a line between them depending on "rule", aligns the numerator and denominator in comparison with each other (indicated by numAlign and denomAlign) and inserts the result at the end of the current TeXFormula.
- Parameters:
num
- the string to be parsed into a TeXFormula that will represent the numerator of the fractiondenom
- the string to be parsed into a TeXFormula that will represent the denominator of the fractionrule
- whether a line should be drawn between numerator and denominatornumAlign
- an alignment constant (fromTeXConstants
) indicating how the numerator should be aligned in comparison with the (larger) denominatordenomAlign
- an alignment constant (from TeXConstants) indicating how the denominator should be aligned in comparison with the (larger) numerator
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if one of the strings could not be parsed correctly
public TeXFormula addFraction(String num, TeXFormula denom, boolean rule) throws ParseException
Parses the given string into a TeXFormula that will represent the numerator of a fraction, uses the given TeXFormula as the denominator of this fraction, draws a line between them depending on "rule" and inserts the result at the end of the current TeXFormula.
- Parameters:
num
- the string to be parsed into a TeXFormula that will represent the numerator of the fractiondenom
- the TeXFormula that will represent the denominator of the fractionrule
- whether a line should be drawn between numerator and denominator
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the string could not be parsed correctly
public TeXFormula addFraction(TeXFormula num, String denom, boolean rule) throws ParseException
Parses the given string into a TeXFormula that will represent the denominator of a fraction, uses the given TeXFormula as the numerator of this fraction, draws a line between them depending on "rule" and inserts the result at the end of the current TeXFormula.
- Parameters:
num
- the TeXFormula that will represent the numerator of the fractiondenom
- the string to be parsed into a TeXFormula that will represent the denominator of the fractionrule
- whether a line should be drawn between numerator and denominator
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the string could not be parsed correctly
public TeXFormula addFraction(TeXFormula num, TeXFormula denom, boolean rule)
Uses the given TeXFormula's as the numerator (num) and denominator (denom) of a fraction, draws a line between them depending on "rule" and inserts the result at the end of the current TeXFormula.
- Parameters:
num
- the TeXFormula that will represent the numerator of the fractiondenom
- the TeXFormula that will represent the denominator of the fractionrule
- whether a line should be drawn between numerator and denominator
- Returns:
- the modified TeXFormula
public TeXFormula addFraction(TeXFormula num, TeXFormula denom, boolean rule, int numAlign, int denomAlign)
Uses the given TeXFormula's as the numerator (num) and denominator (denom) of a fraction, draws a line between them depending on "rule", aligns the numerator and denominator in comparison with each other (indicated by numAlign and denomAlign) and inserts the result at the end of the current TeXFormula.
- Parameters:
num
- the TeXFormula that will represent the numerator of the fractiondenom
- the TeXFormula that will represent the denominator of the fractionrule
- whether a line should be drawn between numerator and denominatornumAlign
- an alignment constant (fromTeXConstants
) indicating how the numerator should be aligned in comparison with the (larger) denominatordenomAlign
- an alignment constant (from TeXConstants) indicating how the denominator should be aligned in comparison with the (larger) numerator
- Returns:
- the modified TeXFormula
public TeXFormula addNthRoot(String base, String nthRoot) throws ParseException
Parses the given strings into TeXFormula's, puts them under a root sign (base) and in the upper left corner over this root sign (nthRoot) and inserts the result at the end of the current TeXFormula.
- Parameters:
base
- the string to be parsed into a TeXFormula that will be put under the root sign.nthRoot
- the string to be parsed into a TeXFormula that will be put in the upper left corner over the root sign
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if one of the strings could not be parsed correctly
public TeXFormula addNthRoot(String base, TeXFormula nthRoot) throws ParseException
Parses the given string into a TeXFormula, puts it under a root sign, puts the given TeXFormula in the upper left corner over this root sign and inserts the result at the end of the current TeXFormula.
- Parameters:
base
- the string to be parsed into a TeXFormula that will be put under the root sign.nthRoot
- the TeXFormula that will be put in the upper left corner over the root sign
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the string could not be parsed correctly
public TeXFormula addNthRoot(TeXFormula base, String nthRoot) throws ParseException
Parses the given string into a TeXFormula, puts it in the upper left corner over the root sign, puts the given TeXFormula under this root sign and inserts the result at the end of the current TeXFormula.
- Parameters:
base
- the TeXFormula that will be put under the root sign.nthRoot
- the string to be parsed into a TeXFormula that will be put in the upper left corner over the root sign
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the strings could not be parsed correctly
public TeXFormula addNthRoot(TeXFormula base, TeXFormula nthRoot)
Puts the given TeXFormula's under a root sign (base) and in the upper left corner over this root sign (nthRoot) and inserts the result at the end of the current TeXFormula.
- Parameters:
base
- the TeXFormula that will be put under the root sign.nthRoot
- the TeXFormula that will be put in the upper left corner over the root sign
- Returns:
- the modified TeXFormula
public TeXFormula addOp(String op, String low, String up) throws ParseException
Parses the given strings into TeXFormula's that will represent a "big operator" (op), it's lower (low) and upper (up) bound, and inserts the result at the end of the current TeXFormula. The positioning of the upper and lower bound (as limits: over and under the "big operator", or as scripts: superscript and subscript) will be determined automatically according to the TeX algorithms. If low is null, the lower bound will be omitted. If up is null, the upper bound will be omitted.
- Parameters:
op
- the string to be parsed into a TeXFormula that will represent the "big operator"low
- the string to be parsed into a TeXFormula that will represent the lower bound of the "big operator" (or null: no lower bound)up
- the string to be parsed into a TeXFormula that will represent the upper bound of the "big operator" (or null: no upper bound)
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if one of the strings could not be parsed correctly
public TeXFormula addOp(String op, String low, String up, boolean lim) throws ParseException
Parses the given strings into TeXFormula's that will represent a "big operator" (op), it's lower (low) and upper (up) bound, and inserts the result at the end of the current TeXFormula. The positioning of the upper and lower bound (as limits: over and under the "big operator", or as scripts: superscript and subscript) is determined by lim.
- Parameters:
op
- the string to be parsed into a TeXFormula that will represent the "big operator"low
- the string to be parsed into a TeXFormula that will represent the lower bound of the "big operator" (or null: no lower bound)up
- the string to be parsed into a TeXFormula that will represent the upper bound of the "big operator" (or null: no upper bound)lim
- whether the upper and lower bound should be displayed as limits (<-> scripts)
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if one of the strings could not be parsed correctly
public TeXFormula addOp(TeXFormula op, TeXFormula low, TeXFormula up)
Uses the given TeXFormula's as a "big operator" (op), it's lower (low) and upper (up) bound, and inserts the result at the end of the current TeXFormula. The positioning of the upper and lower bound (as limits: over and under the "big operator", or as scripts: superscript and subscript) will be determined automatically according to the TeX algorithms. If low is null, the lower bound will be omitted. If up is null, the upper bound will be omitted.
- Parameters:
op
- the TeXFormula that will represent the "big operator"low
- the TeXFormula that will represent the lower bound of the "big operator" (or null: no lower bound)up
- the TeXFormula that will represent the upper bound of the "big operator" (or null: no upper bound)
- Returns:
- the modified TeXFormula
public TeXFormula addOp(TeXFormula op, TeXFormula low, TeXFormula up, boolean lim)
Uses the given TeXFormula's as a "big operator" (op), it's lower (low) and upper (up) bound, and inserts the result at the end of the current TeXFormula. The positioning of the upper and lower bound (as limits: over and under the "big operator", or as scripts: superscript and subscript) is determined by lim.
- Parameters:
op
- the TeXFormula that will represent the "big operator"low
- the TeXFormula that will represent the lower bound of the "big operator" (or null: no lower bound)up
- the TeXFormula that will represent the upper bound of the "big operator" (or null: no upper bound)lim
- whether the upper and lower bound should be displayed as limits (<-> scripts)
- Returns:
- the modified TeXFormula
public TeXFormula addPhantom(String phantom) throws ParseException
Parses the given string into a phantom TeXFormula and inserts the result at the end of the current TeXFormula. A phantom TeXFormula will be rendered invisibly. Although the inserted formula is invisible, it's still treated as a normal visible formula when it comes to inserting glue.
- Parameters:
phantom
- the string to be parsed as a phantom TeXFormula
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the string could not be parsed correctly
public TeXFormula addPhantom(String phantom, boolean width, boolean height, boolean depth) throws ParseException
Parses the given string into a phantom TeXFormula and inserts the result at the end of the current TeXFormula. Only the dimensions set to true will be taken into account for drawing the whitespace. Although the inserted formula is invisible, it's still treated as a normal visible formula when it comes to inserting glue.
- Parameters:
phantom
- the string to be parsed as a phantom TeXFormulawidth
- whether the width of the TeXFormula's box should be used (<-> width 0)height
- whether the height of the TeXFormula's box should be used (<-> height 0)depth
- whether the depth of the TeXFormula's box should be used (<-> depth 0)
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the string could not be parsed correctly
public TeXFormula addPhantom(TeXFormula phantom)
Inserts the given TeXFormula as a phantom TeXFormula at the end of the current TeXFormula. A phantom TeXFormula will be rendered invisibly. Although the inserted formula is invisible, it's still treated as a normal visible formula when it comes to inserting glue.
- Parameters:
phantom
- the TeXFormula to be inserted as a phantom TeXFormula
- Returns:
- the modified TeXFormula
public TeXFormula addPhantom(TeXFormula phantom, boolean width, boolean height, boolean depth)
Inserts the given TeXFormula as a phantom TeXFormula at the end of the current TeXFormula. Only the dimensions set to true will be taken into account for drawing the whitespace. Although the inserted formula is invisible, it's still treated as a normal visible formula when it comes to inserting glue.
- Parameters:
phantom
- the TeXFormula to be inserted as a phantom TeXFormulawidth
- whether the width of the TeXFormula's box should be used (<-> width 0)height
- whether the height of the TeXFormula's box should be used (<-> height 0)depth
- whether the depth of the TeXFormula's box should be used (<-> depth 0)
- Returns:
- the modified TeXFormula
public TeXFormula addSqrt(String base) throws ParseException
Parses the given string into a TeXFormula that will be displayed under a root sign and inserts the result at the end of the current TeXFormula.
- Parameters:
base
- the string to be parsed into a TeXFormula that will be displayed under a root sign
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the string could not be parsed correctly
public TeXFormula addSqrt(TeXFormula base)
Displays the given TeXFormula under a root sign and inserts the result at the end of the current TeXFormula.
- Parameters:
base
- the TeXFormula that will be displayed under a root sign
- Returns:
- the modified TeXFormula
public TeXFormula addStrut(int unit, float width, float height, float depth) throws InvalidUnitException
Inserts a strut box (whitespace) with the given width, height and depth (in the given unit) at the end of the current TeXFormula.
- Parameters:
unit
- a unit constant (fromTeXConstants
)width
- the width of the strut boxheight
- the height of the strut boxdepth
- the depth of the strut box
- Returns:
- the modified TeXFormula
- Throws:
InvalidUnitException
- if the given integer value does not represent a valid unit
public TeXFormula addStrut(int widthUnit, float width, int heightUnit, float height, int depthUnit, float depth) throws InvalidUnitException
Inserts a strut box (whitespace) with the given width (in widthUnits), height (in heightUnits) and depth (in depthUnits) at the end of the current TeXFormula.
- Parameters:
widthUnit
- a unit constant used for the width (fromTeXConstants
)width
- the width of the strut boxheightUnit
- a unit constant used for the height (from TeXConstants)height
- the height of the strut boxdepthUnit
- a unit constant used for the depth (from TeXConstants)depth
- the depth of the strut box
- Returns:
- the modified TeXFormula
- Throws:
InvalidUnitException
- if the given integer value does not represent a valid unit
public TeXFormula addSymbol(String name) throws SymbolNotFoundException
Inserts the symbol with the given name at the end of the current TeXFormula.
- Parameters:
name
- the name of the symbol
- Returns:
- the modified TeXFormula
- Throws:
SymbolNotFoundException
- if there's no symbol defined with the given name
public TeXFormula addSymbol(String name, int type) throws SymbolNotFoundException, InvalidSymbolTypeException
Inserts the symbol with the given name at the end of the current TeXFormula as a symbol of the given symbol type. This type can be (and is meant to be) different from the symbol's defined type.
- Parameters:
name
- the name of the symboltype
- a symbol type constant (fromTeXConstants
)
- Returns:
- the modified TeXFormula
- Throws:
SymbolNotFoundException
- if there's no symbol defined with the given nameInvalidSymbolTypeException
- if the given integer value does not represent a valid symbol type
public TeXFormula centerOnAxis()
Centers the current TeXformula vertically on the axis (defined by the parameter "axisheight" in the resource "DefaultTeXFont.xml".
- Returns:
- the modified TeXFormula
public TeXIcon createTeXIcon(int style, float size)
Creates a TeXIcon from this TeXFormula using the default TeXFont in the given point size and starting from the given TeX style. If the given integer value does not represent a valid TeX style, the default style TeXConstants.STYLE_DISPLAY will be used.
- Parameters:
style
- a TeX style constant (fromTeXConstants
) to start fromsize
- the default TeXFont's point size
- Returns:
- the created TeXIcon
public TeXFormula embrace(String left, String right) throws SymbolNotFoundException, InvalidDelimiterException
Surrounds this TeXFormula with the given delimiters (if not null).
- Parameters:
left
- the symbol name of the left delimiter (or null: no delimiter)right
- the symbol name of the right delimiter (or null: no delimiter)
- Returns:
- the modified TeXFormula
- Throws:
SymbolNotFoundException
- if no symbol is defined for one of the given namesInvalidDelimiterException
- if one of the symbols is not defined as a delimiter symbol
public TeXFormula embrace(char left, char right) throws SymbolNotFoundException, InvalidDelimiterException, DelimiterMappingNotFoundException
Surrounds this TeXFormula with the given delimiters.
- Parameters:
left
- the left delimiter characterright
- the right delimiter character
- Returns:
- the modified TeXFormula
- Throws:
SymbolNotFoundException
- if one of the delimiter characters is mapped to an unknown symbolInvalidDelimiterException
- if one of the delimiter characters is mapped to a symbol that is not defined as a delimiter symbolDelimiterMappingNotFoundException
- if no character-to-symbol mapping is found for one of the delimiter characters
public TeXFormula fraction(String s, boolean rule) throws ParseException
Uses the current TeXFormula as the numerator of a fraction, parses the given string into a TeXFormula that will represent the denominator of the fraction, draws a line between them depending on "rule" and changes the current TeXFormula into this resulting fraction.
- Parameters:
s
- the string to be parsed into a TeXFormula that will represent the denominator of the fractionrule
- whether a line should be drawn between numerator and denominator
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the string could not be parsed correctly
public TeXFormula fraction(String s, boolean rule, int numAlign, int denomAlign) throws ParseException
Uses the current TeXFormula as the numerator of a fraction, parses the given string into a TeXFormula that will represent the denominator of the fraction, possibly draws a line between them depending on "rule", aligns the numerator and denominator in comparison with each other (indicated by numAlign and denomAlign) and changes the current TeXFormula into this resulting fraction.
- Parameters:
s
- the string to be parsed into a TeXFormula that will represent the denominator of the fractionrule
- whether a line should be drawn between numerator and denominatornumAlign
- an alignment constant (fromTeXConstants
) indicating how the numerator should be aligned in comparison with the (larger) denominatordenomAlign
- an alignment constant (from TeXConstants) indicating how the denominator should be aligned in comparison with the (larger) numerator
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the string could not be parsed correctly
public TeXFormula fraction(TeXFormula f, boolean rule)
Uses the current TeXFormula as the numerator of a fraction, the given TeXFormula as the denominator of the fraction, draws a line between them depending on "rule" and changes the current TeXFormula into this resulting fraction.
- Parameters:
f
- the TeXFormula that will represent the denominator of the fractionrule
- whether a line should be drawn between numerator and denominator
- Returns:
- the modified TeXFormula
public TeXFormula fraction(TeXFormula f, boolean rule, int numAlign, int denomAlign)
Uses the current TeXFormula as the numerator of a fraction, the given TeXFormula as the denominator of the fraction, draws a line between them depending on "rule", aligns the numerator and denominator in comparison with each other (indicated by numAlign and denomAlign) and changes the current TeXFormula into this resulting fraction.
- Parameters:
f
- the TeXFormula that will represent the denominator of the fractionrule
- whether a line should be drawn between numerator and denominatornumAlign
- an alignment constant (fromTeXConstants
) indicating how the numerator should be aligned in comparison with the (larger) denominatordenomAlign
- an alignment constant (from TeXConstants) indicating how the denominator should be aligned in comparison with the (larger) numerator
- Returns:
- the modified TeXFormula
public TeXFormula fraction(TeXFormula f, float defaultFactor, int numAlign, int denomAlign)
Uses the current TeXFormula as the numerator of a fraction, the given TeXFormula as the denominator of the fraction, draws a line between them with a thickness of "defaultFactor" times the default rule thickness, aligns the numerator and denominator in comparison with each other (indicated by numAlign and denomAlign) and changes the current TeXFormula into this resulting fraction.
- Parameters:
f
- the TeXFormula that will represent the denominator of the fractiondefaultFactor
- the thickness factor (to be multiplied by the default rule thickness)numAlign
- an alignment constant (from TeXConstants) indicating how the numerator should be aligned in comparison with the (larger) denominatordenomAlign
- an alignment constant (from TeXConstants) indicating how the denominator should be aligned in comparison with the (larger) numerator
- Returns:
- the modified TeXFormula
public TeXFormula fraction(TeXFormula f, int unit, float thickness) throws InvalidUnitException
Uses the current TeXFormula as the numerator of a fraction, the given TeXFormula as the denominator of the fraction, draws a line between them with the given thickness (in the given unit) and changes the current TeXFormula into this resulting fraction.
- Parameters:
f
- the TeXFormula that will represent the denominator of the fractionunit
- a unit constant (fromTeXConstants
)thickness
- the thickness (in the given unit) of the line to be put between the numerator and denominator
- Returns:
- the modified TeXFormula
- Throws:
InvalidUnitException
- if the given integer value does not represent a valid unit
public TeXFormula fraction(TeXFormula f, int unit, float thickness, int numAlign, int denomAlign) throws InvalidUnitException
Uses the current TeXFormula as the numerator of a fraction, the given TeXFormula as the denominator of the fraction, draws a line between them depending on "rule", aligns the numerator and denominator in comparison with each other (indicated by numAlign and denomAlign) and changes the current TeXFormula into this resulting fraction.
- Parameters:
f
- the TeXFormula that will represent the denominator of the fractionunit
- a unit constant (fromTeXConstants
)thickness
- the thickness (in the given unit) of the line to be put between the numerator and denominatornumAlign
- an alignment constant (from TeXConstants) indicating how the numerator should be aligned in comparison with the (larger) denominatordenomAlign
- an alignment constant (from TeXConstants) indicating how the denominator should be aligned in comparison with the (larger) numerator
- Returns:
- the modified TeXFormula
- Throws:
InvalidUnitException
- if the given integer value does not represent a valid unit
public TeXFormula fractionInvert(String s, boolean rule) throws ParseException
Uses the current TeXFormula as the denominator of a fraction, parses the given string into a TeXFormula that will represent the numerator of the fraction, draws a line between them depending on "rule" and changes the current TeXFormula into this resulting fraction.
- Parameters:
s
- the string to be parsed into a TeXFormula that will represent the numerator of the fractionrule
- whether a line should be drawn between numerator and denominator
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the string could not be parsed correctly
public TeXFormula fractionInvert(String s, boolean rule, int numAlign, int denomAlign) throws ParseException
Uses the current TeXFormula as the denominator of a fraction, parses the given string into a TeXFormula that will represent the numerator of the fraction, draws a line between them depending on "rule", aligns the numerator and denominator in comparison with each other (indicated by numAlign and denomAlign) and changes the current TeXFormula into this resulting fraction.
- Parameters:
s
- the string to be parsed into a TeXFormula that will represent the numerator of the fractionrule
- whether a line should be drawn between numerator and denominatornumAlign
- an alignment constant (fromTeXConstants
) indicating how the numerator should be aligned in comparison with the (larger) denominatordenomAlign
- an alignment constant (from TeXConstants) indicating how the denominator should be aligned in comparison with the (larger) numerator
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the string could not be parsed correctly
public TeXFormula fractionInvert(TeXFormula f, boolean rule)
Uses the current TeXFormula as the denominator of a fraction, the given TeXFormula as the numerator of the fraction, draws a line between them depending on "rule" and changes the current TeXFormula into this resulting fraction.
- Parameters:
f
- the TeXFormula that will represent the numerator of the fractionrule
- whether a line should be drawn between numerator and denominator
- Returns:
- the modified TeXFormula
public TeXFormula fractionInvert(TeXFormula f, boolean rule, int numAlign, int denomAlign)
Uses the current TeXFormula as the denominator of a fraction, the given TeXFormula as the numerator of the fraction, draws a line between them depending on "rule", aligns the numerator and denominator in comparison with each other (indicated by numAlign and denomAlign) and changes the current TeXFormula into this resulting fraction.
- Parameters:
f
- the TeXFormula that will represent the numerator of the fractionrule
- whether a line should be drawn between numerator and denominatornumAlign
- an alignment constant (fromTeXConstants
) indicating how the numerator should be aligned in comparison with the (larger) denominatordenomAlign
- an alignment constant (from TeXConstants) indicating how the denominator should be aligned in comparison with the (larger) numerator
- Returns:
- the modified TeXFormula
public static TeXFormula get(String name) throws FormulaNotFoundException
Get a predefined TeXFormula.
- Parameters:
name
- the name of the predefined TeXFormula
- Returns:
- a copy of the predefined TeXFormula
- Throws:
FormulaNotFoundException
- if no predefined TeXFormula is found with the given name
public TeXFormula makePhantom()
Changes this TeXFormula into a phantom TeXFormula. It will be rendered invisibly. This means that a strut box (whitespace) will be displayed instead of the current TeXFormula, with the same width, height and depth as the current TeXFormula's box would have. Although this formula is now made invisible, it's still treated as a normal visible formula when it comes to inserting glue.
- Returns:
- the modified TeXFormula
public TeXFormula makePhantom(boolean width, boolean height, boolean depth)
Changes this TeXFormula into a phantom TeXFormula. Only the dimensions set to true will be taken into account for drawing the whitespace. Although this formula is now made invisible, it's still treated as a normal visible formula when it comes to inserting glue.
- Parameters:
width
- whether the width of the TeXFormula's box should be used (<-> width 0)height
- whether the height of the TeXFormula's box should be used (<-> height 0)depth
- whether the depth of the TeXFormula's box should be used (<-> depth 0)
- Returns:
- the modified TeXFormula
public TeXFormula nthRoot(String nthRoot) throws ParseException
Parses the given string into a TeXFormula, puts it in the upper left corner over a root sign (nthRoot), puts the current TeXFormula under this root sign and changes the current TeXFormula into this resulting root construction.
- Parameters:
nthRoot
- the string to be parsed into a TeXFormula that will be put in the upper left corner over the root sign
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the string could not be parsed correctly
public TeXFormula nthRoot(TeXFormula nthRoot)
Puts the given TeXFormula in the upper left corner over a root sign, puts the current TeXFormula under this root sign and changes the current TeXFormula into this resulting root construction.
- Parameters:
nthRoot
- the TeXFormula that will be put in the upper left corner over the root sign
- Returns:
- the modified TeXFormula
public TeXFormula overline()
Puts a line over the current TeXFormula and changes the current TeXFormula into the resulting construction.
- Returns:
- the modified TeXFormula
public TeXFormula putAccentOver(String accentName) throws InvalidSymbolTypeException, SymbolNotFoundException
Puts the given accent above the current TeXFormula and changes the current TeXFormula into the resulting accent construction.
- Parameters:
accentName
- the name of the accent symbol
- Returns:
- the modified TeXFormula
- Throws:
InvalidSymbolTypeException
- if the symbol is not defined as an accentSymbolNotFoundException
- if there's no symbol defined with the given name
public TeXFormula putDelimiterOver(int delimiter) throws InvalidDelimiterTypeException, SymbolNotFoundException
Puts the delimiter symbol represented by the given delimiter type constant above the current TeXFormula and changes the current TeXFormula into the resulting construction.
- Parameters:
delimiter
- a delimiter type constant (fromTeXConstants
) that represents a delimiter symbol that will be put above the current TeXFormula
- Returns:
- the modified TeXFormula
- Throws:
InvalidDelimiterTypeException
- if the given integer value does not represent a valid delimiter typeSymbolNotFoundException
- if the definition of the symbol represented by the delimiter constant was not found (due to user-made changes!)
public TeXFormula putDelimiterOver(int delimiter, String sup, int kernUnit, float kern) throws InvalidDelimiterTypeException, InvalidUnitException, ParseException, SymbolNotFoundException
Puts the delimiter symbol represented by the given delimiter type constant above the current TeXFormula, parses the given string into a TeXFormula and puts it above the delimiter symbol (seperated by an amount of vertical space defined by the given float value and unit) in a smaller size (unless the current TeXFormula will be displayed in the smallest possible size: the script_script style's size) and finally changes the current TeXFormula into the resulting construction.
- Parameters:
delimiter
- a delimiter type constant (fromTeXConstants
) that represents a delimiter symbol that will be put above the current TeXFormulasup
- the string to be parsed into a TeXFormula that will be put above the delimiter symbol, in a smaller size if possiblekernUnit
- a unit constant (fromTeXConstants
)kern
- amount of vertical space (in kernUnit) to be put between the delimiter and the given TeXFormula sub
- Returns:
- the modified TeXFormula
- Throws:
InvalidDelimiterTypeException
- if the given integer value does not represent a valid delimiter typeInvalidUnitException
- if the given integer value (kernUnit) does not represent a valid unitParseException
- if the given string could not be parsed correctlySymbolNotFoundException
- if the definition of the symbol represented by the delimiter constant was not found (due to user-made changes!)
public TeXFormula putDelimiterOver(int delimiter, TeXFormula sup, int kernUnit, float kern) throws InvalidDelimiterTypeException, InvalidUnitException, SymbolNotFoundException
Puts the delimiter symbol represented by the given delimiter type constant above the current TeXFormula, puts the given TeXFormula above the delimiter symbol (seperated by an amount of vertical space defined by the given float value and unit) in a smaller size (unless the current TeXFormula will be displayed in the smallest possible size: the "script_script" style's size) and finally changes the current TeXFormula into the resulting construction.
- Parameters:
delimiter
- a delimiter type constant (fromTeXConstants
) that represents a delimiter symbol that will be put above the current TeXFormulasup
- the TeXFormula that will be put above the delimiter symbol, in a smaller size if possiblekernUnit
- a unit constant (fromTeXConstants
)kern
- amount of vertical space (in kernUnit) to be put between the delimiter and the given TeXFormula sub
- Returns:
- the modified TeXFormula
- Throws:
InvalidDelimiterTypeException
- if the given integer value does not represent a valid delimiter typeInvalidUnitException
- if the given integer value (kernUnit) does not represent a valid unitSymbolNotFoundException
- if the definition of the symbol represented by the delimiter constant was not found (due to user-made changes!)
public TeXFormula putDelimiterUnder(int delimiter) throws InvalidDelimiterTypeException, SymbolNotFoundException
Puts the delimiter symbol represented by the given delimiter type constant under the current TeXFormula and changes the current TeXFormula into the resulting construction.
- Parameters:
delimiter
- a delimiter type constant (fromTeXConstants
) that represents a delimiter symbol that will be put under the current TeXFormula
- Returns:
- the modified TeXFormula
- Throws:
InvalidDelimiterTypeException
- if the given integer value does not represent a valid delimiter typeSymbolNotFoundException
- if the definition of the symbol represented by the delimiter constant was not found (due to user-made changes!)
public TeXFormula putDelimiterUnder(int delimiter, String sub, int kernUnit, float kern) throws InvalidDelimiterTypeException, InvalidUnitException, ParseException, SymbolNotFoundException
Puts the delimiter symbol represented by the given delimiter type constant under the current TeXFormula, parses the given string into a TeXFormula and puts it under the delimiter symbol (seperated by an amount of vertical space defined by the given float value and unit) in a smaller size (unless the current TeXFormula will be displayed in the smallest possible size: the script_script style's size) and finally changes the current TeXFormula into the resulting construction.
- Parameters:
delimiter
- a delimiter type constant (fromTeXConstants
) that represents a delimiter symbol that will be put under the current TeXFormulasub
- the string to be parsed into a TeXFormula that will be put under the delimiter symbol, in a smaller size if possiblekernUnit
- a unit constant (fromTeXConstants
)kern
- amount of vertical space (in kernUnit) to be put between the delimiter and the given TeXFormula sub
- Returns:
- the modified TeXFormula
- Throws:
InvalidDelimiterTypeException
- if the given integer value does not represent a valid delimiter typeInvalidUnitException
- if the given integer value (kernUnit) does not represent a valid unitParseException
- if the given string could not be parsed correctlySymbolNotFoundException
- if the definition of the symbol represented by the delimiter constant was not found (due to user-made changes!)
public TeXFormula putDelimiterUnder(int delimiter, TeXFormula sub, int kernUnit, float kern) throws InvalidDelimiterTypeException, InvalidUnitException, SymbolNotFoundException
Puts the delimiter symbol represented by the given delimiter type constant under the current TeXFormula, puts the given TeXFormula under the delimiter symbol (seperated by an amount of vertical space defined by the given float value and unit) in a smaller size (unless the current TeXFormula will be displayed in the smallest possible size: the "script_script" style's size) and finally changes the current TeXFormula into the resulting construction.
- Parameters:
delimiter
- a delimiter type constant (fromTeXConstants
) that represents a delimiter symbol that will be put under the current TeXFormulasub
- the TeXFormula that will be put under the delimiter symbol, in a smaller size if possiblekernUnit
- a unit constant (fromTeXConstants
)kern
- amount of vertical space (in kernUnit) to be put between the delimiter and the given TeXFormula sub
- Returns:
- the modified TeXFormula
- Throws:
InvalidDelimiterTypeException
- if the given integer value (delimiter) does not represent a valid delimiter typeInvalidUnitException
- if the given integer value (kernUnit) does not represent a valid unitSymbolNotFoundException
- if the definition of the symbol represented by the delimiter constant was not found (due to user-made changes!)
public TeXFormula putOver(String over, int overUnit, float overSpace, boolean overScriptSize) throws InvalidUnitException
Parses the given string into a TeXFormula that will be put above the current TeXFormula, in a smaller size depending on "overScriptSize" and seperated by a vertical space of size "overSpace" in "overUnit" and changes the current TeXFormula into the resulting construction.
- Parameters:
over
- the string to be parsed into a TeXFormula that will be put over the current TeXFormulaoverUnit
- a unit constant (from TeXConstants)overSpace
- the size (in overUnit) of the vertical space between the current TeXFormula and the TeXFormula (over) that will be put over itoverScriptSize
- whether the TeXFormula (over) that will be put over the current TeXFormula should be displayed in a smaller size (if possible)
- Returns:
- the modified TeXFormula
- Throws:
InvalidUnitException
- if one of the given unit integer values doesn't represent a valid unit
public TeXFormula putOver(TeXFormula over, int overUnit, float overSpace, boolean overScriptSize) throws InvalidUnitException
Puts the given TeXFormula above the current TeXFormula, in a smaller size depending on "overScriptSize" and seperated by a vertical space of size "overSpace" in "overUnit" and changes the current TeXFormula into the resulting construction.
- Parameters:
over
- the TeXFormula to be put over the current TeXFormulaoverUnit
- a unit constant (from TeXConstants)overSpace
- the size (in overUnit) of the vertical space between the current TeXFormula and the TeXFormula (over) that will be put over itoverScriptSize
- whether the TeXFormula (over) that will be put over the current TeXFormula should be displayed in a smaller size (if possible)
- Returns:
- the modified TeXFormula
- Throws:
InvalidUnitException
- if the given unit integer values doesn't represent a valid unit
public TeXFormula putUnder(String under, int underUnit, float underSpace, boolean underScriptSize) throws InvalidUnitException
Parses the given string into a TeXFormula that will be put under the current TeXFormula, in a smaller size depending on "underScriptSize" and seperated by a vertical space of size "underSpace" in "underUnit" and changes the current TeXFormula into the resulting construction.
- Parameters:
under
- the string to be parsed into a TeXFormula that will be put under the current TeXFormula, or null to put nothing under itunderUnit
- a unit constant (fromTeXConstants
)underSpace
- the size (in underUnit) of the vertical space between the current TeXFormula and the TeXFormula (under) that will be put under itunderScriptSize
- whether the TeXFormula (under) that will be put under the current TeXFormula should be displayed in a smaller size (if possible)
- Returns:
- the modified TeXFormula
- Throws:
InvalidUnitException
- if one of the given unit integer values doesn't represent a valid unit
public TeXFormula putUnder(TeXFormula under, int underUnit, float underSpace, boolean underScriptSize) throws InvalidUnitException
Puts the given TeXFormula under the current TeXFormula, in a smaller size depending on "underScriptSize" and seperated by a vertical space of size "underSpace" in "underUnit" and changes the current TeXFormula into the resulting construction.
- Parameters:
under
- the TeXFormula to be put under the current TeXFormulaunderUnit
- a unit constant (fromTeXConstants
)underSpace
- the size (in underUnit) of the vertical space between the current TeXFormula and the TeXFormula (under) that will be put under it (if not null)underScriptSize
- whether the TeXFormula (under) that will be put under the current TeXFormula should be displayed in a smaller size (if possible)
- Returns:
- the modified TeXFormula
- Throws:
InvalidUnitException
- if the given unit integer values doesn't represent a valid unit
public TeXFormula putUnderAndOver(String under, int underUnit, float underSpace, boolean underScriptSize, String over, int overUnit, float overSpace, boolean overScriptSize) throws InvalidUnitException, ParseException
Parses the given string "under" into a TeXFormula that will be put under the current TeXFormula, in a smaller size depending on "underScriptSize" and seperated by a vertical space of size "underSpace" in "underUnit", parses the given string "over" into a TeXFormula that will be put above the current TeXFormula, in a smaller size depending on "overScriptSize" and seperated by a vertical space of size "overSpace" in "overUnit" and finally changes the current TeXFormula into the resulting construction.
- Parameters:
under
- the string to be parsed into a TeXFormula that will be put under the current TeXFormula, or null to put nothing under itunderUnit
- a unit constant (fromTeXConstants
)underSpace
- the size (in underUnit) of the vertical space between the current TeXFormula and the TeXFormula (under) that will be put under itunderScriptSize
- whether the TeXFormula (under) that will be put under the current TeXFormula should be displayed in a smaller size (if possible)over
- the string to be parsed into a TeXFormula that will be put over the current TeXFormula, or null to put nothing over itoverUnit
- a unit constant (from TeXConstants)overSpace
- the size (in overUnit) of the vertical space between the current TeXFormula and the TeXFormula (over) that will be put over itoverScriptSize
- whether the TeXFormula (over) that will be put over the current TeXFormula should be displayed in a smaller size (if possible)
- Returns:
- the modified TeXFormula
- Throws:
InvalidUnitException
- if one of the given unit integer values doesn't represent a valid unit
public TeXFormula putUnderAndOver(TeXFormula under, int underUnit, float underSpace, boolean underScriptSize, TeXFormula over, int overUnit, float overSpace, boolean overScriptSize) throws InvalidUnitException
Puts the given TeXFormula "under" under the current TeXFormula, in a smaller size depending on "underScriptSize" and seperated by a vertical space of size "underSpace" in "underUnit", puts the given TeXFormula "over" above the current TeXFormula, in a smaller size depending on "overScriptSize" and seperated by a vertical space of size "overSpace" in "overUnit" and finally changes the current TeXFormula into the resulting construction.
- Parameters:
under
- the TeXFormula to be put under the current TeXFormulaunderUnit
- a unit constant (fromTeXConstants
)underSpace
- the size (in underUnit) of the vertical space between the current TeXFormula and the TeXFormula (under) that will be put under itunderScriptSize
- whether the TeXFormula (under) that will be put under the current TeXFormula should be displayed in a smaller size (if possible)over
- the TeXFormula to be put over the current TeXFormulaoverUnit
- a unit constant (from TeXConstants)overSpace
- the size (in overUnit) of the vertical space between the current TeXFormula and the TeXFormula (over) that will be put over itoverScriptSize
- whether the TeXFormula (over) that will be put over the current TeXFormula should be displayed in a smaller size (if possible)
- Returns:
- the modified TeXFormula
- Throws:
InvalidUnitException
- if one of the given unit integer values doesn't represent a valid unit
public TeXFormula setBackground(Color c)
Changes the background color of the current TeXFormula into the given color. By default, a TeXFormula has no background color, it's transparent. The backgrounds of subformula's will be painted on top of the background of the whole formula! Any changes that will be made to this TeXFormula after this background color was set, will have the default background color (unless it will also be changed into another color afterwards)!
- Parameters:
c
- the desired background color for the current TeXFormula
- Returns:
- the modified TeXFormula
public TeXFormula setColor(Color c)
Changes the (foreground) color of the current TeXFormula into the given color. By default, the foreground color of a TeXFormula is the foreground color of the component on which the TeXIcon (created from this TeXFormula) will be painted. The color of subformula's overrides the color of the whole formula. Any changes that will be made to this TeXFormula after this color was set, will be painted in the default color (unless the color will also be changed afterwards into another color)!
- Parameters:
c
- the desired foreground color for the current TeXFormula
- Returns:
- the modified TeXFormula
public TeXFormula setFixedTypes(int leftType, int rightType) throws InvalidAtomTypeException
Sets a fixed left and right type of the current TeXFormula. This has an influence on the glue that will be inserted before and after this TeXFormula.
- Parameters:
leftType
- atom type constant (fromTeXConstants
)rightType
- atom type constant (from TeXConstants)
- Returns:
- the modified TeXFormula
- Throws:
InvalidAtomTypeException
- if the given integer value does not represent a valid atom type
public TeXFormula setScripts(String sub, String sup) throws ParseException
Parses the given strings into TeXFormula's and attaches them together to the current TeXFormula as a subscript (sub) and a superscript (sup). This is not the same as attaching both scripts seperately one after another (in either order) using the setSubscript(String) and the setSuperscript(String) methods!
- Parameters:
sub
- the string to be parsed into a TeXFormula that will be attached to the current TeXFormula as a subscriptsup
- the string to be parsed into a TeXFormula that will be attached to the current TeXFormula as a superscript
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if one of the given strings could not be parsed correctly
public TeXFormula setScripts(String sub, TeXFormula sup) throws ParseException
Parses the given string into a TeXFormula's and attaches it to the current TeXFormula as a subscript together with the given TeXFormula (as a superscript). This is not the same as attaching both scripts seperately one after another (in either order) using the setSubscript(String) and the setSuperscript(TeXFormula) methods!
- Parameters:
sub
- the string to be parsed into a TeXFormula that will be attached to the current TeXFormula as a subscriptsup
- the TeXFormula that will be attached to the current TeXFormula as a superscript
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the given string could not be parsed correctly
public TeXFormula setScripts(TeXFormula sub, String sup) throws ParseException
Parses the given string into a TeXFormula's and attaches it to the current TeXFormula as a superscript together with the given TeXFormula (as a subscript). This is not the same as attaching both scripts seperately one after another (in either order) using the setSubscript(TeXFormula) and the setSuperscript(String) methods!
- Parameters:
sub
- the TeXFormula that will be attached to the current TeXFormula as a subscriptsup
- the string to be parsed into a TeXFormula that will be attached to the current TeXFormula as a superscript
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the given string could not be parsed correctly
public TeXFormula setScripts(TeXFormula sub, TeXFormula sup)
Attaches the given TeXFormula's together to the current TeXFormula as a subscript (sub) and a superscript (sup). This is not the same as attaching both scripts seperately one after another (in either order) using the setSubscript(TeXFormula) and the setSuperscript(TeXFormula) methods!
- Parameters:
sub
- the TeXFormula that will be attached to the current TeXFormula as a subscriptsup
- the TeXFormula that will be attached to the current TeXFormula as a superscript
- Returns:
- the modified TeXFormula
public TeXFormula setSubscript(String sub) throws ParseException
Parses the given string into a TeXFormula and attaches it to the current TeXFormula as a subscript.
- Parameters:
sub
- the string to be parsed into a TeXFormula that will be attached to the current TeXFormula as a subscript
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the given string could not be parsed correctly
public TeXFormula setSubscript(TeXFormula sub)
Attaches the given TeXFormula to the current TeXFormula as a subscript.
- Parameters:
sub
- the TeXFormula that will be attached to the current TeXFormula as a subscript
- Returns:
- the modified TeXFormula
public TeXFormula setSuperscript(String sup) throws ParseException
Parses the given string into a TeXFormula and attaches it to the current TeXFormula as a superscript.
- Parameters:
sup
- the string to be parsed into a TeXFormula that will be attached to the current TeXFormula as a superscript
- Returns:
- the modified TeXFormula
- Throws:
ParseException
- if the given string could not be parsed correctly
public TeXFormula setSuperscript(TeXFormula sup)
Attaches the given TeXFormula to the current TeXFormula as a superscript.
- Parameters:
sup
- the TeXFormula that will be attached to the current TeXFormula as a superscript
- Returns:
- the modified TeXFormula
public TeXFormula sqrt()
Puts the current TeXFormula under a root sign and changes the current TeXFormula into the resulting square root construction.
- Returns:
- the modified TeXFormula
public TeXFormula underline()
Puts a line under the current TeXFormula and changes the current TeXFormula into the resulting construction.
- Returns:
- the modified TeXFormula