|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.scilab.forge.jlatexmath.TeXFormula
public class TeXFormula
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 | |
---|---|
boolean |
isColored
|
java.util.List<MiddleAtom> |
middle
|
protected static float |
PREC
|
static java.util.Map<java.lang.String,TeXFormula> |
predefinedTeXFormulas
|
Atom |
root
|
static Atom[] |
symbolFormulaMappings
|
static java.lang.String[] |
symbolMappings
|
java.lang.String |
textStyle
|
static java.lang.String |
VERSION
|
Constructor Summary | |
---|---|
TeXFormula()
Creates an empty TeXFormula. |
|
TeXFormula(java.lang.String s)
Creates a new TeXFormula by parsing the given string (using a primitive TeX parser). |
|
TeXFormula(java.lang.String s,
boolean firstpass)
|
|
TeXFormula(java.lang.String s,
java.lang.String textStyle)
|
|
TeXFormula(java.lang.String s,
java.lang.String textStyle,
boolean firstpass,
boolean space)
|
|
TeXFormula(TeXFormula f)
Creates a new TeXFormula that is a copy of the given TeXFormula. |
Method Summary | |
---|---|
TeXFormula |
add(Atom el)
|
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. |
static void |
addPredefinedCommands(java.io.InputStream xmlFile)
|
static void |
addPredefinedTeXFormula(java.io.InputStream xmlFile)
|
TeXFormula |
addStrut(int type)
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 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. |
static void |
addSymbolMappings(java.io.InputStream in,
java.lang.String name)
|
static void |
addSymbolMappings(java.lang.String file)
|
TeXFormula |
append(java.lang.String s)
|
TeXFormula |
centerOnAxis()
Centers the current TeXformula vertically on the axis (defined by the parameter "axisheight" in the resource "DefaultTeXFont.xml". |
void |
createGIF(int style,
float size,
java.lang.String out,
java.awt.Color bg,
java.awt.Color fg)
|
void |
createImage(java.lang.String format,
int style,
float size,
java.lang.String out,
java.awt.Color bg,
java.awt.Color fg,
boolean transparency)
|
void |
createJPEG(int style,
float size,
java.lang.String out,
java.awt.Color bg,
java.awt.Color fg)
|
void |
createPNG(int style,
float size,
java.lang.String out,
java.awt.Color bg,
java.awt.Color fg)
|
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. |
TeXIcon |
createTeXIcon(int style,
float size,
int widthUnit,
float textwidth,
int align)
|
static TeXFormula |
get(java.lang.String name)
Get a predefined TeXFormula. |
boolean |
getLookAtLastAtom()
|
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. |
void |
setDEBUG(boolean b)
|
TeXFormula |
setFixedTypes(int leftType,
int rightType)
Sets a fixed left and right type of the current TeXFormula. |
void |
setLookAtLastAtom(boolean b)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VERSION
protected static final float PREC
public static java.util.Map<java.lang.String,TeXFormula> predefinedTeXFormulas
public static java.lang.String[] symbolMappings
public static Atom[] symbolFormulaMappings
public java.util.List<MiddleAtom> middle
public Atom root
public java.lang.String textStyle
public boolean isColored
Constructor Detail |
---|
public TeXFormula()
public TeXFormula(java.lang.String s) throws ParseException
s
- the string to be parsed
ParseException
- if the string could not be parsed correctlypublic TeXFormula(java.lang.String s, boolean firstpass) throws ParseException
ParseException
public TeXFormula(java.lang.String s, java.lang.String textStyle) throws ParseException
ParseException
public TeXFormula(java.lang.String s, java.lang.String textStyle, boolean firstpass, boolean space) throws ParseException
ParseException
public TeXFormula(TeXFormula f)
Both TeXFormula's are independent of one another!
f
- the formula to be copiedMethod Detail |
---|
public static void addSymbolMappings(java.lang.String file) throws ResourceParseException
ResourceParseException
public static void addSymbolMappings(java.io.InputStream in, java.lang.String name) throws ResourceParseException
ResourceParseException
public TeXFormula add(Atom el)
public TeXFormula add(java.lang.String s) throws ParseException
s
- the string to be parsed and inserted
ParseException
- if the string could not be parsed correctlypublic TeXFormula append(java.lang.String s) throws ParseException
ParseException
public TeXFormula add(TeXFormula f)
f
- the TeXFormula to be inserted
public void setLookAtLastAtom(boolean b)
public boolean getLookAtLastAtom()
public TeXFormula centerOnAxis()
public static void addPredefinedTeXFormula(java.io.InputStream xmlFile) throws ResourceParseException
ResourceParseException
public static void addPredefinedCommands(java.io.InputStream xmlFile) throws ResourceParseException
ResourceParseException
public TeXFormula addStrut(int unit, float width, float height, float depth) throws InvalidUnitException
unit
- a unit constant (from TeXConstants
)width
- the width of the strut boxheight
- the height of the strut boxdepth
- the depth of the strut box
InvalidUnitException
- if the given integer value does not represent
a valid unitpublic TeXFormula addStrut(int type) throws InvalidUnitException
type
- thinmuskip, medmuskip or thickmuskip (from TeXConstants
)
InvalidUnitException
- if the given integer value does not represent
a valid unitpublic TeXFormula addStrut(int widthUnit, float width, int heightUnit, float height, int depthUnit, float depth) throws InvalidUnitException
widthUnit
- a unit constant used for the width (from TeXConstants
)width
- the width of the strut boxheightUnit
- a unit constant used for the height (from TeXConstants)height
- the height of the strut boxdepthUnit
- a unit constant used for the depth (from TeXConstants)depth
- the depth of the strut box
InvalidUnitException
- if the given integer value does not represent
a valid unitpublic TeXIcon createTeXIcon(int style, float size)
style
- a TeX style constant (from TeXConstants
) to start fromsize
- the default TeXFont's point size
public TeXIcon createTeXIcon(int style, float size, int widthUnit, float textwidth, int align)
public void createImage(java.lang.String format, int style, float size, java.lang.String out, java.awt.Color bg, java.awt.Color fg, boolean transparency)
public void createPNG(int style, float size, java.lang.String out, java.awt.Color bg, java.awt.Color fg)
public void createGIF(int style, float size, java.lang.String out, java.awt.Color bg, java.awt.Color fg)
public void createJPEG(int style, float size, java.lang.String out, java.awt.Color bg, java.awt.Color fg)
public void setDEBUG(boolean b)
public TeXFormula setBackground(java.awt.Color c)
c
- the desired background color for the current TeXFormula
public TeXFormula setColor(java.awt.Color c)
c
- the desired foreground color for the current TeXFormula
public TeXFormula setFixedTypes(int leftType, int rightType) throws InvalidAtomTypeException
leftType
- atom type constant (from TeXConstants
)rightType
- atom type constant (from TeXConstants)
InvalidAtomTypeException
- if the given integer value does not represent
a valid atom typepublic static TeXFormula get(java.lang.String name) throws FormulaNotFoundException
name
- the name of the predefined TeXFormula
FormulaNotFoundException
- if no predefined TeXFormula is found with the
given name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |