Class TeXFormula
- Direct Known Subclasses:
ArrayOfAtoms
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!
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassApply the Builder pattern instead of using the createTeXIcon(...) factories -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates an empty TeXFormula.TeXFormula(String s) Creates a new TeXFormula by parsing the given string (using a primitive TeX parser).TeXFormula(String s, boolean firstpass) TeXFormula(String s, String textStyle) TeXFormula(String s, String textStyle, boolean firstpass, boolean space) TeXFormula(String s, Map<String, String> map) Creates a new TeXFormula by parsing the given string (using a primitive TeX parser).Creates a new TeXFormula that is a copy of the given TeXFormula.protectedTeXFormula(TeXParser tp) Creates an empty TeXFormula.protectedTeXFormula(TeXParser tp, String s) Creates a new TeXFormula by parsing the given string (using a primitive TeX parser).protectedTeXFormula(TeXParser tp, String s, boolean firstpass) protectedTeXFormula(TeXParser tp, String s, String textStyle) protectedTeXFormula(TeXParser tp, String s, String textStyle, boolean firstpass, boolean space) -
Method Summary
Modifier and TypeMethodDescriptionInserts an atom at the end of the current formulastatic voidaddSymbolMappings(InputStream in, String name) 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.static TeXFormulaGet a predefined TeXFormula.voidChange the text of the TeXFormula and regenerate the root
-
Field Details
-
VERSION
- See Also:
-
SERIF
public static final int SERIF- See Also:
-
SANSSERIF
public static final int SANSSERIF- See Also:
-
BOLD
public static final int BOLD- See Also:
-
ITALIC
public static final int ITALIC- See Also:
-
ROMAN
public static final int ROMAN- See Also:
-
TYPEWRITER
public static final int TYPEWRITER- See Also:
-
PIXELS_PER_POINT
public static float PIXELS_PER_POINT -
FONT_SCALE_FACTOR
public static float FONT_SCALE_FACTOR -
PREC
protected static final float PREC- See Also:
-
predefinedTeXFormulas
-
predefinedTeXFormulasAsString
-
symbolMappings
-
symbolTextMappings
-
symbolFormulaMappings
-
middle
-
jlmXMLMap
-
root
-
textStyle
-
isColored
public boolean isColored
-
-
Constructor Details
-
TeXFormula
public TeXFormula()Creates an empty TeXFormula. -
TeXFormula
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
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
- Throws:
ParseException
-
TeXFormula
- Throws:
ParseException
-
TeXFormula
public TeXFormula(String s, String textStyle, boolean firstpass, boolean space) throws ParseException - Throws:
ParseException
-
TeXFormula
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
-
TeXFormula
Creates an empty TeXFormula. -
TeXFormula
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
- Throws:
ParseException
-
TeXFormula
- Throws:
ParseException
-
TeXFormula
protected TeXFormula(TeXParser tp, String s, String textStyle, boolean firstpass, boolean space) throws ParseException - Throws:
ParseException
-
-
Method Details
-
addSymbolMappings
- Throws:
ResourceParseException
-
setLaTeX
Change the text of the TeXFormula and regenerate the root- Parameters:
ltx- the latex formula- Throws:
ParseException
-
add
Inserts an atom at the end of the current formula -
append
- Throws:
ParseException
-
createTeXIcon
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
-
get
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
-