be.ugent.caagt.jmathtex
Class TeXFormula

java.lang.Object
  extended by be.ugent.caagt.jmathtex.TeXFormula

public class TeXFormula
extends java.lang.Object

Represents a logical mathematical formula that will be displayed (by creating a 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!


Field Summary
protected static float PREC
           
protected  be.ugent.caagt.jmathtex.Atom root
           
 
Constructor Summary
TeXFormula()
          Creates an empty TeXFormula.
TeXFormula(java.util.List<TeXFormula> l)
          Creates a new TeXFormula from a list of TeXFormula objects.
TeXFormula(java.lang.String s)
          Creates a new TeXFormula by parsing the given string (using a primitive TeX parser).
TeXFormula(TeXFormula f)
          Creates a new TeXFormula that is a copy of the given TeXFormula.
 
Method Summary
 TeXFormula add(java.lang.String s)
          Parses the given string and inserts the resulting formula at the end of the current TeXFormula.
 TeXFormula add(TeXFormula f)
          Inserts the given TeXFormula at the end of the current TeXFormula.
 TeXFormula addAcc(java.lang.String s, java.lang.String accentName)
          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.
 TeXFormula addAcc(TeXFormula base, java.lang.String accentName)
          Puts the given accent above the given TeXFormula and inserts the result at the end of the current TeXFormula.
 TeXFormula addAcc(TeXFormula base, TeXFormula accent)
          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.
 TeXFormula addEmbraced(java.lang.String s, char l, char r)
          Parses the given string into a TeXFormula, surrounds it with the given delimiters and inserts the result at the end of the current TeXformula.
 TeXFormula addEmbraced(java.lang.String s, java.lang.String left, java.lang.String right)
          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.
 TeXFormula addEmbraced(TeXFormula f, char l, char r)
          Surrounds the given TeXFormula with the given delimiters and inserts the result at the end of the current TeXformula.
 TeXFormula addEmbraced(TeXFormula f, java.lang.String left, java.lang.String right)
          Surrounds the given TeXFormula with the given delimiters (if not null) and inserts the result at the end of the current TeXFormula.
 TeXFormula addFraction(java.lang.String num, java.lang.String denom, boolean rule)
          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.
 TeXFormula addFraction(java.lang.String num, java.lang.String denom, boolean rule, int numAlign, int denomAlign)
          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.
 TeXFormula addFraction(java.lang.String num, TeXFormula denom, boolean rule)
          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.
 TeXFormula addFraction(TeXFormula num, java.lang.String denom, boolean rule)
          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.
 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.
 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.
 TeXFormula addNthRoot(java.lang.String base, java.lang.String nthRoot)
          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.
 TeXFormula addNthRoot(java.lang.String base, TeXFormula nthRoot)
          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.
 TeXFormula addNthRoot(TeXFormula base, java.lang.String nthRoot)
          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.
 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.
 TeXFormula addOp(java.lang.String op, java.lang.String low, java.lang.String up)
          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.
 TeXFormula addOp(java.lang.String op, java.lang.String low, java.lang.String up, boolean lim)
          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.
 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.
 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.
 TeXFormula addPhantom(java.lang.String phantom)
          Parses the given string into a phantom TeXFormula and inserts the result at the end of the current TeXFormula.
 TeXFormula addPhantom(java.lang.String phantom, boolean width, boolean height, boolean depth)
          Parses the given string into a phantom TeXFormula and inserts the result at the end of the current TeXFormula.
 TeXFormula addPhantom(TeXFormula phantom)
          Inserts the given TeXFormula as a phantom TeXFormula at the end of the current TeXFormula.
 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.
 TeXFormula addSqrt(java.lang.String base)
          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.
 TeXFormula addSqrt(TeXFormula base)
          Displays the given TeXFormula under a root sign and inserts the result at the end of the current TeXFormula.
 TeXFormula addStrut(int unit, float width, float height, float depth)
          Inserts a strut box (whitespace) with the given width, height and depth (in the given unit) at the end of the current TeXFormula.
 TeXFormula addStrut(int widthUnit, float width, int heightUnit, float height, int depthUnit, float depth)
          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.
 TeXFormula addSymbol(java.lang.String name)
          Inserts the symbol with the given name at the end of the current TeXFormula.
 TeXFormula addSymbol(java.lang.String name, int type)
          Inserts the symbol with the given name at the end of the current TeXFormula as a symbol of the given symbol type.
 TeXFormula centerOnAxis()
          Centers the current TeXformula vertically on the axis (defined by the parameter "axisheight" in the resource "DefaultTeXFont.xml".
 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.
 TeXFormula embrace(char left, char right)
          Surrounds this TeXFormula with the given delimiters.
 TeXFormula embrace(java.lang.String left, java.lang.String right)
          Surrounds this TeXFormula with the given delimiters (if not null).
 TeXFormula fraction(java.lang.String s, boolean rule)
          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.
 TeXFormula fraction(java.lang.String s, boolean rule, int numAlign, int denomAlign)
          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.
 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.
 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.
 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.
 TeXFormula fraction(TeXFormula f, int unit, float thickness)
          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.
 TeXFormula fraction(TeXFormula f, int unit, float thickness, 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.
 TeXFormula fractionInvert(java.lang.String s, boolean rule)
          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.
 TeXFormula fractionInvert(java.lang.String s, boolean rule, int numAlign, int denomAlign)
          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.
 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.
 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.
static TeXFormula get(java.lang.String name)
          Get a predefined TeXFormula.
 TeXFormula makePhantom()
          Changes this TeXFormula into a phantom TeXFormula.
 TeXFormula makePhantom(boolean width, boolean height, boolean depth)
          Changes this TeXFormula into a phantom TeXFormula.
 TeXFormula nthRoot(java.lang.String nthRoot)
          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.
 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.
 TeXFormula overline()
          Puts a line over the current TeXFormula and changes the current TeXFormula into the resulting construction.
 TeXFormula putAccentOver(java.lang.String accentName)
          Puts the given accent above the current TeXFormula and changes the current TeXFormula into the resulting accent construction.
 TeXFormula putDelimiterOver(int delimiter)
          Puts the delimiter symbol represented by the given delimiter type constant above the current TeXFormula and changes the current TeXFormula into the resulting construction.
 TeXFormula putDelimiterOver(int delimiter, java.lang.String sup, int kernUnit, float kern)
          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.
 TeXFormula putDelimiterOver(int delimiter, TeXFormula sup, int kernUnit, float kern)
          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.
 TeXFormula putDelimiterUnder(int delimiter)
          Puts the delimiter symbol represented by the given delimiter type constant under the current TeXFormula and changes the current TeXFormula into the resulting construction.
 TeXFormula putDelimiterUnder(int delimiter, java.lang.String sub, int kernUnit, float kern)
          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.
 TeXFormula putDelimiterUnder(int delimiter, TeXFormula sub, int kernUnit, float kern)
          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.
 TeXFormula putOver(java.lang.String over, int overUnit, float overSpace, boolean overScriptSize)
          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.
 TeXFormula putOver(TeXFormula over, int overUnit, float overSpace, boolean overScriptSize)
          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.
 TeXFormula putUnder(java.lang.String under, int underUnit, float underSpace, boolean underScriptSize)
          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.
 TeXFormula putUnder(TeXFormula under, int underUnit, float underSpace, boolean underScriptSize)
          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.
 TeXFormula putUnderAndOver(java.lang.String under, int underUnit, float underSpace, boolean underScriptSize, java.lang.String over, int overUnit, float overSpace, boolean overScriptSize)
          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.
 TeXFormula putUnderAndOver(TeXFormula under, int underUnit, float underSpace, boolean underScriptSize, TeXFormula over, int overUnit, float overSpace, boolean overScriptSize)
          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.
 TeXFormula setBackground(java.awt.Color c)
          Changes the background color of the current TeXFormula into the given color.
 TeXFormula setColor(java.awt.Color c)
          Changes the (foreground) color of the current TeXFormula into the given color.
 TeXFormula setFixedTypes(int leftType, int rightType)
          Sets a fixed left and right type of the current TeXFormula.
 TeXFormula setScripts(java.lang.String sub, java.lang.String sup)
          Parses the given strings into TeXFormula's and attaches them together to the current TeXFormula as a subscript (sub) and a superscript (sup).
 TeXFormula setScripts(java.lang.String sub, TeXFormula sup)
          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).
 TeXFormula setScripts(TeXFormula sub, java.lang.String sup)
          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).
 TeXFormula setScripts(TeXFormula sub, TeXFormula sup)
          Attaches the given TeXFormula's together to the current TeXFormula as a subscript (sub) and a superscript (sup).
 TeXFormula setSubscript(java.lang.String sub)
          Parses the given string into a TeXFormula and attaches it to the current TeXFormula as a subscript.
 TeXFormula setSubscript(TeXFormula sub)
          Attaches the given TeXFormula to the current TeXFormula as a subscript.
 TeXFormula setSuperscript(java.lang.String sup)
          Parses the given string into a TeXFormula and attaches it to the current TeXFormula as a superscript.
 TeXFormula setSuperscript(TeXFormula sup)
          Attaches the given TeXFormula to the current TeXFormula as a superscript.
 TeXFormula sqrt()
          Puts the current TeXFormula under a root sign and changes the current TeXFormula into the resulting square root construction.
 TeXFormula underline()
          Puts a line under the current TeXFormula and changes the current TeXFormula into the resulting construction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREC

protected static final float PREC
See Also:
Constant Field Values

root

protected be.ugent.caagt.jmathtex.Atom root
Constructor Detail

TeXFormula

public TeXFormula()
Creates an empty TeXFormula.


TeXFormula

public TeXFormula(java.util.List<TeXFormula> l)
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 the add(TeXFormula) method.

The new TeXFormula is independent of all the TeXFormula's from the list!

Parameters:
l - a list of TeXFormula objects

TeXFormula

public TeXFormula(java.lang.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

TeXFormula

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
Method Detail

add

public TeXFormula add(java.lang.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

add

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

centerOnAxis

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

addAcc

public TeXFormula addAcc(java.lang.String s,
                         java.lang.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 placed
accentName - the name of the accent symbol
Returns:
the modified TeXFormula
Throws:
InvalidSymbolTypeException - if the symbol is not defined as an accent
SymbolNotFoundException - if there's no symbol defined with the given name
ParseException - if the string(s) could not be parsed correctly

addAcc

public TeXFormula addAcc(TeXFormula base,
                         java.lang.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 placed
accentName - the name of the accent symbol
Returns:
the modified TeXFormula
Throws:
InvalidSymbolTypeException - if the symbol is not defined as an accent
SymbolNotFoundException - if there's no symbol defined with the given name

addAcc

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 placed
accent - 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 accent
InvalidTeXFormulaException - if the given accent TeXFormula does not represent a single symbol

addEmbraced

public TeXFormula addEmbraced(java.lang.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 delimiters
l - the left delimiter character
r - the right delimiter character
Returns:
the modified TeXFormula
Throws:
SymbolNotFoundException - if one of the delimiter characters is mapped to an unknown symbol
InvalidDelimiterException - if one of the delimiter characters is mapped to a symbol that is not defined as a delimiter symbol
ParseException - if the string could not be parsed correctly
DelimiterMappingNotFoundException - if no character-to-symbol mapping is found for one of the delimiter characters

addEmbraced

public TeXFormula addEmbraced(java.lang.String s,
                              java.lang.String left,
                              java.lang.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 delimiters
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 names
ParseException - if the string(s) could not be parsed correctly
InvalidDelimiterException - if one of the symbols is not defined as a delimiter symbol

addEmbraced

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 delimiters
l - the left delimiter character
r - the right delimiter character
Returns:
the modified TeXFormula
Throws:
SymbolNotFoundException - if one of the delimiter characters is mapped to an unknown symbol
InvalidDelimiterException - if one of the delimiter characters is mapped to a symbol that is not defined as a delimiter symbol
DelimiterMappingNotFoundException - if no character-to-symbol mapping is found for one of the delimiter characters

addEmbraced

public TeXFormula addEmbraced(TeXFormula f,
                              java.lang.String left,
                              java.lang.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 delimiters
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 names
InvalidDelimiterException - if one of the symbols is not defined as a delimiter symbol

addFraction

public TeXFormula addFraction(java.lang.String num,
                              java.lang.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 fraction
denom - the string to be parsed into a TeXFormula that will represent the denominator of the fraction
rule - 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

addFraction

public TeXFormula addFraction(java.lang.String num,
                              java.lang.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 fraction
denom - the string to be parsed into a TeXFormula that will represent the denominator of the fraction
rule - whether a line should be drawn between numerator and denominator
numAlign - an alignment constant (from TeXConstants) indicating how the numerator should be aligned in comparison with the (larger) denominator
denomAlign - 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

addFraction

public TeXFormula addFraction(java.lang.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 fraction
denom - the TeXFormula that will represent the denominator of the fraction
rule - whether a line should be drawn between numerator and denominator
Returns:
the modified TeXFormula
Throws:
ParseException - if the string could not be parsed correctly

addFraction

public TeXFormula addFraction(TeXFormula num,
                              java.lang.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 fraction
denom - the string to be parsed into a TeXFormula that will represent the denominator of the fraction
rule - whether a line should be drawn between numerator and denominator
Returns:
the modified TeXFormula
Throws:
ParseException - if the string could not be parsed correctly

addFraction

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 fraction
denom - the TeXFormula that will represent the denominator of the fraction
rule - whether a line should be drawn between numerator and denominator
Returns:
the modified TeXFormula

addFraction

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 fraction
denom - the TeXFormula that will represent the denominator of the fraction
rule - whether a line should be drawn between numerator and denominator
numAlign - an alignment constant (from TeXConstants) indicating how the numerator should be aligned in comparison with the (larger) denominator
denomAlign - an alignment constant (from TeXConstants) indicating how the denominator should be aligned in comparison with the (larger) numerator
Returns:
the modified TeXFormula

addNthRoot

public TeXFormula addNthRoot(java.lang.String base,
                             java.lang.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

addNthRoot

public TeXFormula addNthRoot(java.lang.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

addNthRoot

public TeXFormula addNthRoot(TeXFormula base,
                             java.lang.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

addNthRoot

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

addOp

public TeXFormula addOp(java.lang.String op,
                        java.lang.String low,
                        java.lang.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

addOp

public TeXFormula addOp(java.lang.String op,
                        java.lang.String low,
                        java.lang.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

addOp

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

addOp

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

addPhantom

public TeXFormula addPhantom(java.lang.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

addPhantom

public TeXFormula addPhantom(java.lang.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 TeXFormula
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
Throws:
ParseException - if the string could not be parsed correctly

addPhantom

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

addPhantom

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 TeXFormula
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

addSqrt

public TeXFormula addSqrt(java.lang.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

addSqrt

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

addStrut

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 (from TeXConstants)
width - the width of the strut box
height - the height of the strut box
depth - the depth of the strut box
Returns:
the modified TeXFormula
Throws:
InvalidUnitException - if the given integer value does not represent a valid unit

addStrut

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 (from TeXConstants)
width - the width of the strut box
heightUnit - a unit constant used for the height (from TeXConstants)
height - the height of the strut box
depthUnit - 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

addSymbol

public TeXFormula addSymbol(java.lang.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

addSymbol

public TeXFormula addSymbol(java.lang.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 symbol
type - a symbol type constant (from TeXConstants)
Returns:
the modified TeXFormula
Throws:
SymbolNotFoundException - if there's no symbol defined with the given name
InvalidSymbolTypeException - if the given integer value does not represent a valid symbol type

createTeXIcon

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 (from TeXConstants) to start from
size - the default TeXFont's point size
Returns:
the created TeXIcon

embrace

public TeXFormula embrace(char left,
                          char right)
                   throws SymbolNotFoundException,
                          InvalidDelimiterException,
                          DelimiterMappingNotFoundException
Surrounds this TeXFormula with the given delimiters.

Parameters:
left - the left delimiter character
right - the right delimiter character
Returns:
the modified TeXFormula
Throws:
SymbolNotFoundException - if one of the delimiter characters is mapped to an unknown symbol
InvalidDelimiterException - if one of the delimiter characters is mapped to a symbol that is not defined as a delimiter symbol
DelimiterMappingNotFoundException - if no character-to-symbol mapping is found for one of the delimiter characters

embrace

public TeXFormula embrace(java.lang.String left,
                          java.lang.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 names
InvalidDelimiterException - if one of the symbols is not defined as a delimiter symbol

fraction

public TeXFormula fraction(java.lang.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 fraction
rule - whether a line should be drawn between numerator and denominator
Returns:
the modified TeXFormula
Throws:
ParseException - if the string could not be parsed correctly

fraction

public TeXFormula fraction(java.lang.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 fraction
rule - whether a line should be drawn between numerator and denominator
numAlign - an alignment constant (from TeXConstants) indicating how the numerator should be aligned in comparison with the (larger) denominator
denomAlign - 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

fraction

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 fraction
rule - whether a line should be drawn between numerator and denominator
Returns:
the modified TeXFormula

fraction

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 fraction
unit - a unit constant (from TeXConstants)
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

fraction

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 fraction
unit - a unit constant (from TeXConstants)
thickness - the thickness (in the given unit) of the line to be put between the numerator and denominator
numAlign - an alignment constant (from TeXConstants) indicating how the numerator should be aligned in comparison with the (larger) denominator
denomAlign - 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

fraction

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 fraction
defaultFactor - 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) denominator
denomAlign - an alignment constant (from TeXConstants) indicating how the denominator should be aligned in comparison with the (larger) numerator
Returns:
the modified TeXFormula

fraction

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 fraction
rule - whether a line should be drawn between numerator and denominator
numAlign - an alignment constant (from TeXConstants) indicating how the numerator should be aligned in comparison with the (larger) denominator
denomAlign - an alignment constant (from TeXConstants) indicating how the denominator should be aligned in comparison with the (larger) numerator
Returns:
the modified TeXFormula

fractionInvert

public TeXFormula fractionInvert(java.lang.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 fraction
rule - whether a line should be drawn between numerator and denominator
Returns:
the modified TeXFormula
Throws:
ParseException - if the string could not be parsed correctly

fractionInvert

public TeXFormula fractionInvert(java.lang.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 fraction
rule - whether a line should be drawn between numerator and denominator
numAlign - an alignment constant (from TeXConstants) indicating how the numerator should be aligned in comparison with the (larger) denominator
denomAlign - 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

fractionInvert

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 fraction
rule - whether a line should be drawn between numerator and denominator
Returns:
the modified TeXFormula

fractionInvert

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 fraction
rule - whether a line should be drawn between numerator and denominator
numAlign - an alignment constant (from TeXConstants) indicating how the numerator should be aligned in comparison with the (larger) denominator
denomAlign - an alignment constant (from TeXConstants) indicating how the denominator should be aligned in comparison with the (larger) numerator
Returns:
the modified TeXFormula

makePhantom

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

makePhantom

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

nthRoot

public TeXFormula nthRoot(java.lang.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

nthRoot

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

overline

public TeXFormula overline()
Puts a line over the current TeXFormula and changes the current TeXFormula into the resulting construction.

Returns:
the modified TeXFormula

putAccentOver

public TeXFormula putAccentOver(java.lang.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 accent
SymbolNotFoundException - if there's no symbol defined with the given name

putDelimiterOver

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 (from TeXConstants) 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 type
SymbolNotFoundException - if the definition of the symbol represented by the delimiter constant was not found (due to user-made changes!)

putDelimiterOver

public TeXFormula putDelimiterOver(int delimiter,
                                   java.lang.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 (from TeXConstants) that represents a delimiter symbol that will be put above the current TeXFormula
sup - the string to be parsed into a TeXFormula that will be put above the delimiter symbol, in a smaller size if possible
kernUnit - a unit constant (from TeXConstants)
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 type
InvalidUnitException - if the given integer value (kernUnit) does not represent a valid unit
ParseException - if the given string could not be parsed correctly
SymbolNotFoundException - if the definition of the symbol represented by the delimiter constant was not found (due to user-made changes!)

putDelimiterOver

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 (from TeXConstants) that represents a delimiter symbol that will be put above the current TeXFormula
sup - the TeXFormula that will be put above the delimiter symbol, in a smaller size if possible
kernUnit - a unit constant (from TeXConstants)
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 type
InvalidUnitException - if the given integer value (kernUnit) does not represent a valid unit
SymbolNotFoundException - if the definition of the symbol represented by the delimiter constant was not found (due to user-made changes!)

putDelimiterUnder

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 (from TeXConstants) 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 type
SymbolNotFoundException - if the definition of the symbol represented by the delimiter constant was not found (due to user-made changes!)

putDelimiterUnder

public TeXFormula putDelimiterUnder(int delimiter,
                                    java.lang.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 (from TeXConstants) that represents a delimiter symbol that will be put under the current TeXFormula
sub - the string to be parsed into a TeXFormula that will be put under the delimiter symbol, in a smaller size if possible
kernUnit - a unit constant (from TeXConstants)
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 type
InvalidUnitException - if the given integer value (kernUnit) does not represent a valid unit
ParseException - if the given string could not be parsed correctly
SymbolNotFoundException - if the definition of the symbol represented by the delimiter constant was not found (due to user-made changes!)

putDelimiterUnder

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 (from TeXConstants) that represents a delimiter symbol that will be put under the current TeXFormula
sub - the TeXFormula that will be put under the delimiter symbol, in a smaller size if possible
kernUnit - a unit constant (from TeXConstants)
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 type
InvalidUnitException - if the given integer value (kernUnit) does not represent a valid unit
SymbolNotFoundException - if the definition of the symbol represented by the delimiter constant was not found (due to user-made changes!)

putOver

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 TeXFormula
overUnit - 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 it
overScriptSize - 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

putOver

public TeXFormula putOver(java.lang.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 TeXFormula
overUnit - 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 it
overScriptSize - 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
parseException - if the given string could not be parsed correctly

putUnder

public TeXFormula putUnder(java.lang.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 it
underUnit - a unit constant (from TeXConstants)
underSpace - the size (in underUnit) of the vertical space between the current TeXFormula and the TeXFormula (under) that will be put under it
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 one of the given unit integer values doesn't represent a valid unit
parseException - if the given string could not be parsed correctly

putUnder

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 TeXFormula
underUnit - a unit constant (from TeXConstants)
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

putUnderAndOver

public TeXFormula putUnderAndOver(java.lang.String under,
                                  int underUnit,
                                  float underSpace,
                                  boolean underScriptSize,
                                  java.lang.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 it
underUnit - a unit constant (from TeXConstants)
underSpace - the size (in underUnit) of the vertical space between the current TeXFormula and the TeXFormula (under) that will be put under it
underScriptSize - 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 it
overUnit - 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 it
overScriptSize - 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
parseException - if one of the given strings could not be parsed correctly
ParseException

putUnderAndOver

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 TeXFormula
underUnit - a unit constant (from TeXConstants)
underSpace - the size (in underUnit) of the vertical space between the current TeXFormula and the TeXFormula (under) that will be put under it
underScriptSize - 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 TeXFormula
overUnit - 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 it
overScriptSize - 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

setBackground

public TeXFormula setBackground(java.awt.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

setColor

public TeXFormula setColor(java.awt.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

setFixedTypes

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 (from TeXConstants)
rightType - atom type constant (from TeXConstants)
Returns:
the modified TeXFormula
Throws:
InvalidAtomTypeException - if the given integer value does not represent a valid atom type

setScripts

public TeXFormula setScripts(java.lang.String sub,
                             java.lang.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 subscript
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 one of the given strings could not be parsed correctly

setScripts

public TeXFormula setScripts(java.lang.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 subscript
sup - 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

setScripts

public TeXFormula setScripts(TeXFormula sub,
                             java.lang.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 subscript
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

setScripts

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 subscript
sup - the TeXFormula that will be attached to the current TeXFormula as a superscript
Returns:
the modified TeXFormula

setSubscript

public TeXFormula setSubscript(java.lang.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

setSubscript

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

setSuperscript

public TeXFormula setSuperscript(java.lang.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

setSuperscript

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

sqrt

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

underline

public TeXFormula underline()
Puts a line under the current TeXFormula and changes the current TeXFormula into the resulting construction.

Returns:
the modified TeXFormula

get

public static TeXFormula get(java.lang.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