jfig.utils
Class LP2

java.lang.Object
  extended byjfig.utils.LP2

public class LP2
extends java.lang.Object

a class to parse and convert simple TeX/LaTeX-style strings into formatted FIG compound objects. the following things work right now: most elementary commands \$, \%, \/, "a..."s etc., font selection (index, ptSize, color) basic formatting (rm, em, tt, itt, btt) color selection basic math commands, if corresponding Unicode chars available basic spacing commands subscripts and superscripts with grouped {arguments} but these do not: subscript / superscript without grouped arguments macros with arguments, user-defined macros, Notes: cmsy10.ttf: "<=" = 0x2219 cmmi10.ttf "\kappa" = 0x2219


Nested Class Summary
 class LP2.Box
          like TeX, we try to abut aligned Box'es, each of which consists of other Boxes in turn, with single character CharBoxes as the basic building blocks.
 class LP2.CharBox
          a CharBox that holds a single character or a string of characters of the specified font.
 class LP2.CommandBox
          a class to encapsulate a LaTeX command with arguments
 class LP2.GroupBox
          a GroupBox corresponds to a TeX/LaTeX group and therefore is limited by a '{' and '}' pair of braces.
 class LP2.SqrtBox
           
 class LP2.StackBox
          a StackBox manages three entries for boxes stacked one upon each other: bottom, center, and top.
 class LP2.SubSuperScriptBox
          a Box that holds a sub- and a superscript Box
 
Field Summary
(package private) static java.lang.String[] _mode_names
           
(package private) static int BEGINGROUP
           
(package private) static int BEGINMATH
           
(package private) static int CMANY
           
(package private) static int CMERR
           
(package private) static int CMEX
           
(package private) static int CMMI
           
(package private) static int CMR
           
(package private) static int CMSL
           
(package private) static int CMSS
           
(package private) static int CMSY
           
(package private) static int CMTT
           
(package private)  ColorCache colorCache
           
(package private)  int colorIndex
           
(package private) static int COMMAND
           
(package private) static int CONTROL
           
(package private) static int count
           
(package private)  LP2.Box current
           
(package private) static boolean debug
           
(package private)  java.util.Stack delayedCommandStack
           
(package private)  boolean display_boxes
           
(package private)  boolean dump_tokens
           
(package private) static int ENDGROUP
           
(package private) static int ENDMATH
           
(package private)  FontCache fontCache
           
(package private)  int fontIndex
           
(package private)  int fontMode
           
(package private) static java.awt.Graphics2D imageGraphics2D
           
(package private) static int INVALID
           
(package private)  int italic_correction
           
(package private)  java.lang.String line
           
(package private)  LP2.Box master
           
(package private) static int MATH
           
(package private)  int mathBackupFontIndex
           
(package private) static int MATHDIGIT
           
(package private)  int mathFontIndex
           
(package private)  int mathGreekFontIndex
           
(package private) static int MATHSYMBOL
           
(package private)  int mathSymbolFontIndex
           
(package private)  int mode
           
(package private) static int MSAM
           
(package private) static int MSBM
           
(package private)  java.lang.Object pdfMapper
           
(package private)  int pos
           
(package private)  int ptBaseSize
           
(package private)  int ptSize
           
(package private)  java.util.Stack stack
           
(package private) static int SUBSCRIPT
           
 int[][] subscriptPtSizes
           
(package private) static int SUPERSCRIPT
           
(package private) static int TEXT
           
(package private) static int THINSPACE
           
(package private)  java.lang.StringBuffer token
           
(package private)  java.util.Vector tokens
           
(package private)  java.util.Vector types
           
(package private) static java.util.Hashtable undefinedCommandWarningsTable
           
(package private) static int USE_CM_FONTS
           
(package private) static int USE_LUCIDA_FONTS
           
(package private) static int USE_SYMBOL_FONT
           
(package private)  boolean use_word_boxes
           
 
Constructor Summary
LP2()
           
 
Method Summary
 LP2.Box __make_line(double x, double y, double width)
          create a thin horizontal line of the given width (i.e.
 void __space(int pixels)
           
 int _acute(java.lang.Object[] a)
           
 void _aleph()
           
 void _alpha()
           
 void _Alpha()
           
 void _amalg()
           
 void _angle()
           
 void _approx()
           
 void _approxeq()
           
 void _arccos()
           
 void _arcsin()
           
 void _arctan()
           
 void _arg()
           
 void _arrowvert()
           
 void _Arrowvert()
           
 void _ast()
           
 void _asymp()
           
 void _atan()
           
 void _atsign()
           
 void _backslash()
           
 int _bar(java.lang.Object[] a)
           
 void _beta()
           
 void _Beta()
           
 void _beth()
           
 void _bf()
           
 void _bigcap()
           
 void _bigcirc()
           
 void _bigcup()
           
 void _bigodot()
           
 void _bigoplus()
           
 void _bigotimes()
           
 void _bigsqcup()
           
 void _bigtriangledown()
           
 void _bigtriangleup()
           
 void _biguplus()
           
 void _bigvee()
           
 void _bigwedge()
           
 void _black()
           
 void _blue()
           
 void _bot()
           
 void _bowtie()
           
 void _Box()
           
 void _bracevert()
           
 void _btt()
           
 void _buildrel()
           
 void _bullet()
           
 void _calA()
           
 void _calB()
           
 void _calC()
           
 void _calD()
           
 void _calE()
           
 void _calF()
           
 void _calG()
           
 void _calH()
           
 void _calI()
           
 void _calJ()
           
 void _calK()
           
 void _calL()
           
 void _calM()
           
 void _calN()
           
 void _calO()
           
 void _calP()
           
 void _calQ()
           
 void _calR()
           
 void _calS()
           
 void _calT()
           
 void _calU()
           
 void _calV()
           
 void _calW()
           
 void _calX()
           
 void _calY()
           
 void _calZ()
           
 void _cap()
           
 void _cdot()
           
 void _cdots_internal()
           
 void _cdots()
           
 void _cdotvar()
           
 void _celsius()
           
 int _check(java.lang.Object[] a)
           
 void _chi()
           
 void _Chi()
           
 void _circ()
           
 void _circlearrowleft()
           
 void _circlearrowright()
           
 void _clubsuit()
           
 void _colon()
           
 void _complement()
           
 void _cong()
           
 void _coprod()
           
 void _copyright()
           
 void _cos()
           
 void _cosh()
           
 void _cot()
           
 void _coth()
           
 void _csc()
           
 int _cstack(java.lang.Object[] args)
           
 void _cubicroot()
           
 void _cup()
           
 void _cyan()
           
 void _dag()
           
 void _dagger()
           
 void _daleth()
           
 void _darkblue()
           
 void _darkgreen()
           
 void _darkpink()
           
 void _darkred()
           
 void _dashv()
           
 void _ddag()
           
 void _ddagger()
           
 int _ddot(java.lang.Object[] a)
           
 void _ddots()
           
 void _define()
           
 void _deg()
           
 void _degrees()
           
 void _delta()
           
 void _Delta()
           
 void _det()
           
 void _diamond()
           
 void _Diamond()
           
 void _diamondsuit()
           
 void _digamma()
           
 void _dim()
           
 void _div()
           
 int _dot(java.lang.Object[] a)
           
 void _doteq()
           
 void _doublebar()
           
 void _downarrow()
           
 void _Downarrow()
           
 int _dq(java.lang.Object[] a)
           
 void _eightpt()
           
 void _eightteenpt()
           
 void _eightypt()
           
 void _elevenpt()
           
 void _ell()
           
 void _em()
           
 void _emptyset()
           
 void _emspace()
           
 void _epsilon()
           
 void _Epsilon()
           
 void _equalchar()
           
 void _equals()
           
 void _equiv()
           
 void _eta()
           
 void _Eta()
           
 void _euro()
           
 void _exists()
           
 void _exp()
           
 void _fahrenheit()
           
 void _female()
           
 void _fifteenpt()
           
 void _fiftyfivept()
           
 void _fiftypt()
           
 void _fivept()
           
 void _flat()
           
 void _footnotesize()
           
 void _forall()
           
 void _fourteenpt()
           
 void _fourthroot()
           
 void _fourtyfivept()
           
 void _fourtypt()
           
 int _frac(java.lang.Object[] args)
           
 void _frown()
           
 void _gamma()
           
 void _Gamma()
           
 void _gcd()
           
 void _ge()
           
 void _geq()
           
 void _gets()
           
 void _gg()
           
 void _ggg()
           
 void _gimel()
           
 void _gold()
           
 int _grave(java.lang.Object[] a)
           
 void _greaterchar()
           
 void _greaterthan()
           
 void _greeko()
           
 void _Greeko()
           
 void _green()
           
 void _hashsign()
           
 int _hat(java.lang.Object[] a)
           
 void _hbar()
           
 void _heartsuit()
           
 void _hom()
           
 void _hookleftarrow()
           
 void _hookrightarrow()
           
 void _huge()
           
 void _Huge()
           
 void _hundredpt()
           
 void _iff()
           
 void _iiint()
           
 void _iint()
           
 void _Im()
           
 void _imath()
           
 void _in()
           
 void _inf()
           
 void _infty()
           
 void _Int_BEGIN()
           
 void _int()
           
 int _Int(java.lang.Object[] args)
          big integral symbol with super/subscripts above and below
 void _iota()
           
 void _Iota()
           
 void _it()
           
 void _itt()
           
 void _jmath()
           
 void _Join()
           
 void _kappa()
           
 void _Kappa()
           
 void _ker()
           
 void _lambda()
           
 void _Lambda()
           
 void _land()
           
 void _langle()
           
 void _large()
           
 void _Large()
           
 void _LARGE()
           
 void _lbrace()
           
 void _lbrack()
           
 void _lbracket()
           
 void _lceil()
           
 void _ldots_internal()
           
 void _ldots()
           
 void _le()
           
 void _leftarrow()
           
 void _Leftarrow()
           
 void _leftharpoondown()
           
 void _leftharpoonup()
           
 void _leftrightarrow()
           
 void _Leftrightarrow()
           
 void _leftrightsquigarrow()
           
 void _leq()
           
 void _lesschar()
           
 void _lessthan()
           
 void _lfloor()
           
 void _lg()
           
 void _lgroup()
           
 void _lhd()
           
 void _lightblue()
           
 void _lim()
           
 void _liminf()
           
 void _limsup()
           
 void _ll()
           
 void _lll()
           
 void _lmoustache()
           
 void _ln()
           
 void _lnot()
           
 void _log()
           
 void _longleftarrow()
           
 void _Longleftarrow()
           
 void _longleftrightarrow()
           
 void _Longleftrightarrow()
           
 void _longmapsto()
           
 void _longrightarrow()
           
 void _Longrightarrow()
           
 void _looparrowleft()
           
 void _looparrowright()
           
 void _lor()
           
 int _lstack(java.lang.Object[] args)
           
 void _magenta()
           
 void _male()
           
 void _mapsto()
           
 void _mathrm()
          request roman font in math mode.
 void _mathslash()
           
 void _max()
           
 void _mbackslash()
           
 void _mho()
           
 void _mid()
           
 void _min()
           
 void _minus()
           
 void _models()
           
 void _mp()
           
 void _mskip_back()
           
 void _mskip_med()
           
 void _mskip_thick()
           
 void _mskip_thin()
           
 void _mu()
           
 void _Mu()
           
 void _nabla()
           
 void _natural()
           
 void _ne()
           
 void _nearrow()
           
 void _neg()
           
 void _neq()
           
 void _nexists()
           
 void _ni()
           
 void _ninept()
           
 void _nineteenpt()
           
 void _ninetypt()
           
 void _nleftarrow()
           
 void _nLeftarrow()
           
 void _nleftrightarrow()
           
 void _nLeftrightarrow()
           
 void _normalsize()
           
 void _not_internal()
           
 void _not()
          put a slash through the following relation symbol.
 void _notin()
           
 void _nrightarrow()
           
 void _nRightarrow()
           
 void _nu()
           
 void _Nu()
           
 void _nwarrow()
           
 void _odot()
           
 void _oint()
           
 void _oldstyle()
           
 void _omega()
           
 void _Omega()
           
 void _ominus()
           
 void _oplus()
           
 void _oslash()
           
 void _otimes()
           
 void _over()
           
 int _overbrace()
           
 void _overleftarrow()
           
 int _overline(java.lang.Object[] args)
           
 void _overrightarrow()
           
 void _owns()
           
 void _P()
           
 void _paragraph()
           
 void _parallel()
           
 void _partial()
           
 void _percent()
           
 void _perp()
           
 void _phi()
           
 void _Phi()
           
 void _pi()
           
 void _Pi()
           
 void _pm()
           
 int _pmb()
           
 void _pound()
           
 void _Pr()
           
 void _prec()
           
 void _preceq()
           
 void _prime()
           
 void _Prod_BEGIN()
           
 void _prod()
           
 int _Prod(java.lang.Object[] args)
          product symbol with super/subscripts above and below
 void _promille()
           
 void _proportional()
           
 void _propto()
           
 void _psi()
           
 void _Psi()
           
 void _pts()
           
 void _qquad()
           
 void _rangle()
           
 void _rbrace()
           
 void _rbrack()
           
 void _rbracket()
           
 void _rceil()
           
 void _Re()
           
 void _red()
           
 void _rfloor()
           
 void _rgroup()
           
 void _rhd()
           
 void _rho()
           
 void _Rho()
           
 void _rightarrow()
           
 void _Rightarrow()
           
 void _rightharpoondown()
           
 void _rightharpoonup()
           
 void _rightleftharpoons()
           
 void _rm()
           
 void _rmoustache()
           
 void _root()
           
 int _rstack(java.lang.Object[] args)
           
 void _S()
           
 void _sc()
           
 void _scriptsize()
           
 void _searrow()
           
 void _sec()
           
 void _setminus()
           
 void _setN()
           
 void _setR()
           
 void _setZ()
           
 void _sevenpt()
           
 void _seventeenpt()
           
 void _seventypt()
           
 void _sf()
           
 void _sgn()
           
 void _sharp()
           
 void _sigma()
           
 void _Sigma()
           
 void _sim()
           
 void _simeq()
           
 void _sin()
           
 void _sinh()
           
 void _sixpt()
           
 void _sixteenpt()
           
 void _sixtypt()
           
 void _sl()
           
 void _slash()
           
 void _small()
           
 void _smile()
           
 void _smiley()
           
 void _smileyblack()
           
 void _spadesuit()
           
 void _sqcap()
           
 void _sqcup()
           
 int _sqrt(java.lang.Object[] args)
           
 int _sqrtn()
           
 void _sqsubset()
           
 void _sqsubseteq()
           
 void _sqsupset()
           
 void _sqsupseteq()
           
 void _square()
           
 void _star()
           
 void _strut()
           
 void _subset()
           
 void _subseteq()
           
 void _succ()
           
 void _succeq()
           
 void _Sum_BEGIN()
           
 void _sum()
           
 int _Sum(java.lang.Object[] args)
          sum symbol with super/subscripts above and below
 void _sup()
           
 void _supset()
           
 void _supseteq()
           
 void _surd()
           
 void _swarrow()
           
 void _tan()
           
 void _tanh()
           
 void _tau()
           
 void _Tau()
           
 void _telephone()
           
 void _tenpt()
           
 void _theta()
           
 void _Theta()
           
 void _thinspace()
           
 void _thirteenpt()
           
 void _thirtyfivept()
           
 void _thirtypt()
           
 int _tilde(java.lang.Object[] a)
           
 void _tildechar()
           
 void _times()
           
 void _tiny()
           
 void _to()
           
 void _today()
           
 void _top()
           
 void _triangle()
           
 void _triangleleft()
           
 void _triangleright()
           
 void _tt()
           
 void _twelvept()
           
 void _twentyeightpt()
           
 void _twentyfivept()
           
 void _twentyfourpt()
           
 void _twentyninept()
           
 void _twentyonept()
           
 void _twentypt()
           
 void _twentysevenpt()
           
 void _twentysixpt()
           
 void _twentythreept()
           
 void _twentytwopt()
           
 int _underbrace()
           
 int _underline(java.lang.Object[] args)
           
 void _unlhd()
           
 void _unrhd()
           
 void _uparrow()
           
 void _Uparrow()
           
 void _updownarrow()
           
 void _Updownarrow()
           
 void _uplus()
           
 void _upsilon()
           
 void _Upsilon()
           
 void _varepsilon()
           
 void _varnothing()
           
 void _varphi()
           
 void _varpi()
           
 void _varpropto()
           
 void _varrho()
           
 void _varsigma()
           
 void _vartheta()
           
 void _vdash()
           
 void _vdots()
           
 int _vec(java.lang.Object[] a)
           
 void _vee()
           
 void _vert()
           
 void _Vert()
           
 void _verticalbar()
           
 void _wedge()
           
 void _white()
           
 void _widehat()
           
 void _widetilde()
           
 void _wp()
           
 void _wr()
           
 void _xi()
           
 void _Xi()
           
 void _xiiipt()
           
 void _xiipt()
           
 void _xipt()
           
 void _xivpt()
           
 void _xixpt()
           
 void _xlpt()
           
 void _xpt()
           
 void _xviiipt()
           
 void _xviipt()
           
 void _xvipt()
           
 void _xvpt()
           
 void _xxiiipt()
           
 void _xxiipt()
           
 void _xxipt()
           
 void _xxivpt()
           
 void _xxpt()
           
 void _xxviipt()
           
 void _xxvipt()
           
 void _xxvpt()
           
 void _xxxpt()
           
 void _xxxvpt()
           
 void _yellow()
           
 void _zeta()
           
 void _Zeta()
           
 int accent(java.lang.String cmd, java.lang.Object[] args)
          if called with args=null, return number of expected arguments, i.e.
(package private)  void addMathSpaceToken()
           
(package private)  void addShortCommandToken(java.lang.String s)
           
 void append(LP2.Box box)
           
(package private)  void big_opr(java.lang.String s, int cmfont, int c)
          big operator symbol, no display-math super/subscripts yet
(package private)  void binaryop(java.lang.String s, int cmfont, int c)
          thinspace, operator, thinspace
 LP2.Box buildBox()
          build a compound set of nested Boxes for the given array of tokens, starting with the specified FIG font in the given size.
 void buildBoxHandleBeginCommand(java.lang.String cmd, int n_args)
           
 void buildBoxHandleBeginGroup()
          called from buildBox() when a BEGIN_GROUP or BEGIN_MATH is encountered
 void buildBoxHandleEndGroup()
          called from buildBox() when an END_GROUP or END_MATH is encountered
(package private)  void calli(java.lang.String s, int cmfont, int c)
           
 void convertToFig(FigCompound compound)
           
 void dumpTokens()
           
 void FIXME(java.lang.String s)
           
 java.lang.Object getState()
           
 int getStringWidthPoints(int fontIndex, int ptSize, java.lang.String s)
           
(package private)  void greek(java.lang.String s)
           
(package private)  void greek(java.lang.String s, int cmfont, int c)
           
(package private)  java.lang.String handle_double_quote()
           
 int handleCommand(java.lang.String command)
          look for a public method called ("_" + command) and try to execute it.
 int handleCommand(java.lang.String command, java.lang.Object[] args)
           
 void handleMathDigit(java.lang.String token)
           
 void handleMathSymbol(java.lang.String token)
           
 boolean isAscii(char c)
           
 boolean isDigit(char c)
           
 boolean isMathSymbol(char c)
           
 boolean isPunctuation(char c)
           
 boolean isTextToken(char c)
           
 boolean isUmlaut(char c)
           
 boolean isWhitespace(char c)
           
static void main(java.lang.String[] argv)
           
(package private)  void mathfunction(java.lang.String s)
           
static void msg(java.lang.String s)
           
 void parse(java.lang.String s)
           
(package private)  void relation(java.lang.String s, int cmfont, int c)
          thinspace, operator, thinspace
(package private)  void relation(java.lang.String s, int cmfont1, int c1, int cmfont2, int c2, int dx)
           
 void selftest(java.lang.String s)
           
 void setColorIndex(int colorIndex)
           
 void setEnableDisplayBoxes(boolean b)
           
 void setEnableDumpTokens(boolean b)
           
 void setFontIndex(int fontIndex)
           
 void setFontMode(int mode)
           
 void setFontPtSize(int ptSize)
           
 void setPDFMapper(java.lang.Object _mapper)
          hack to allow itext PDF export to change font metrics as needed
 void setState(java.lang.Object tmp)
           
 void setUseWords(boolean b)
          whether or not to concatenate CharBoxes with matching attributes
(package private)  void space(int points)
           
(package private)  java.lang.String tokenize_command()
           
(package private)  void tokenize(java.lang.String _line)
          tokenize one line of text input using the TeX grammar.
(package private)  void unicode(java.lang.String s)
           
(package private)  void unicode(java.lang.String s, int cmfont, int c)
           
(package private)  void unicode(java.lang.String s, int cmfont1, int c1, int cmfont2, int c2, int dx)
           
static void usage()
           
(package private)  void writeFigHeader(java.io.PrintStream ps)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

static boolean debug

dump_tokens

boolean dump_tokens

display_boxes

boolean display_boxes

use_word_boxes

boolean use_word_boxes

THINSPACE

static final int THINSPACE
See Also:
Constant Field Values

USE_LUCIDA_FONTS

static final int USE_LUCIDA_FONTS
See Also:
Constant Field Values

USE_CM_FONTS

static final int USE_CM_FONTS
See Also:
Constant Field Values

USE_SYMBOL_FONT

static final int USE_SYMBOL_FONT
See Also:
Constant Field Values

CMERR

static final int CMERR
See Also:
Constant Field Values

CMANY

static final int CMANY
See Also:
Constant Field Values

CMR

static final int CMR
See Also:
Constant Field Values

CMMI

static final int CMMI
See Also:
Constant Field Values

CMSS

static final int CMSS
See Also:
Constant Field Values

CMSL

static final int CMSL
See Also:
Constant Field Values

CMSY

static final int CMSY
See Also:
Constant Field Values

CMTT

static final int CMTT
See Also:
Constant Field Values

CMEX

static final int CMEX
See Also:
Constant Field Values

MSAM

static final int MSAM
See Also:
Constant Field Values

MSBM

static final int MSBM
See Also:
Constant Field Values

fontMode

int fontMode

mathFontIndex

int mathFontIndex

mathGreekFontIndex

int mathGreekFontIndex

mathSymbolFontIndex

int mathSymbolFontIndex

mathBackupFontIndex

int mathBackupFontIndex

colorCache

ColorCache colorCache

fontCache

FontCache fontCache

token

java.lang.StringBuffer token

tokens

java.util.Vector tokens

types

java.util.Vector types

line

java.lang.String line

pos

int pos

mode

int mode

stack

java.util.Stack stack

delayedCommandStack

java.util.Stack delayedCommandStack

master

LP2.Box master

current

LP2.Box current

fontIndex

int fontIndex

ptBaseSize

int ptBaseSize

ptSize

int ptSize

colorIndex

int colorIndex

italic_correction

int italic_correction

pdfMapper

java.lang.Object pdfMapper

imageGraphics2D

static java.awt.Graphics2D imageGraphics2D

undefinedCommandWarningsTable

static java.util.Hashtable undefinedCommandWarningsTable

INVALID

static final int INVALID
See Also:
Constant Field Values

TEXT

static final int TEXT
See Also:
Constant Field Values

COMMAND

static final int COMMAND
See Also:
Constant Field Values

MATH

static final int MATH
See Also:
Constant Field Values

BEGINGROUP

static final int BEGINGROUP
See Also:
Constant Field Values

ENDGROUP

static final int ENDGROUP
See Also:
Constant Field Values

CONTROL

static final int CONTROL
See Also:
Constant Field Values

BEGINMATH

static final int BEGINMATH
See Also:
Constant Field Values

ENDMATH

static final int ENDMATH
See Also:
Constant Field Values

SUPERSCRIPT

static final int SUPERSCRIPT
See Also:
Constant Field Values

SUBSCRIPT

static final int SUBSCRIPT
See Also:
Constant Field Values

MATHSYMBOL

static final int MATHSYMBOL
See Also:
Constant Field Values

MATHDIGIT

static final int MATHDIGIT
See Also:
Constant Field Values

_mode_names

static final java.lang.String[] _mode_names

subscriptPtSizes

public final int[][] subscriptPtSizes

count

static int count
Constructor Detail

LP2

public LP2()
Method Detail

setFontMode

public void setFontMode(int mode)

setPDFMapper

public void setPDFMapper(java.lang.Object _mapper)
hack to allow itext PDF export to change font metrics as needed


getStringWidthPoints

public int getStringWidthPoints(int fontIndex,
                                int ptSize,
                                java.lang.String s)

tokenize_command

java.lang.String tokenize_command()

handle_double_quote

java.lang.String handle_double_quote()

addShortCommandToken

void addShortCommandToken(java.lang.String s)

addMathSpaceToken

void addMathSpaceToken()

tokenize

void tokenize(java.lang.String _line)
tokenize one line of text input using the TeX grammar. This method reads the input line from left to right while keeping track of the current mode (starting from LR-text mode) and recognizing both short (like "\$") and long commands. It creates the "tokens" Vector that contains the set of tokens. This method currently recognizes and supports the following constructs:


isTextToken

public boolean isTextToken(char c)

isAscii

public boolean isAscii(char c)

isUmlaut

public boolean isUmlaut(char c)

isDigit

public boolean isDigit(char c)

isWhitespace

public boolean isWhitespace(char c)

isPunctuation

public boolean isPunctuation(char c)

isMathSymbol

public boolean isMathSymbol(char c)

dumpTokens

public void dumpTokens()

getState

public java.lang.Object getState()

setState

public void setState(java.lang.Object tmp)

append

public void append(LP2.Box box)

buildBox

public LP2.Box buildBox()
build a compound set of nested Boxes for the given array of tokens, starting with the specified FIG font in the given size.


buildBoxHandleBeginGroup

public void buildBoxHandleBeginGroup()
called from buildBox() when a BEGIN_GROUP or BEGIN_MATH is encountered


buildBoxHandleBeginCommand

public void buildBoxHandleBeginCommand(java.lang.String cmd,
                                       int n_args)

buildBoxHandleEndGroup

public void buildBoxHandleEndGroup()
called from buildBox() when an END_GROUP or END_MATH is encountered


handleMathSymbol

public void handleMathSymbol(java.lang.String token)

handleMathDigit

public void handleMathDigit(java.lang.String token)

handleCommand

public int handleCommand(java.lang.String command)
look for a public method called ("_" + command) and try to execute it. We first check for a Java method without arguments, which corresponds to TeX/LaTeX macros without arguments. If no such method exists, we next check for a Java method with a single argument of type Object[]. We pass in a (Object[]) null and expect the method to just return the number of arguments it wants but do nothing else. The method will later be called again after all required argument Group's have be visited, this time with the Object[] array filled in with the respective Group's.


handleCommand

public int handleCommand(java.lang.String command,
                         java.lang.Object[] args)

FIXME

public void FIXME(java.lang.String s)

_today

public void _today()

_bf

public void _bf()

_it

public void _it()

_em

public void _em()

_rm

public void _rm()

_sf

public void _sf()

_sl

public void _sl()

_sc

public void _sc()

_mathrm

public void _mathrm()
request roman font in math mode. In TeX, this command takes one argument, but we just change the font index globally here. This works in both TeX/LaTeX and jfig2 if you use the following idiom: $math italic text {\mathrm{math roman}} more math italic$.


_tt

public void _tt()

_btt

public void _btt()

_itt

public void _itt()

_black

public void _black()

_red

public void _red()

_green

public void _green()

_blue

public void _blue()

_cyan

public void _cyan()

_magenta

public void _magenta()

_yellow

public void _yellow()

_white

public void _white()

_darkblue

public void _darkblue()

_lightblue

public void _lightblue()

_darkgreen

public void _darkgreen()

_darkred

public void _darkred()

_darkpink

public void _darkpink()

_gold

public void _gold()

_fivept

public void _fivept()

_sixpt

public void _sixpt()

_sevenpt

public void _sevenpt()

_eightpt

public void _eightpt()

_ninept

public void _ninept()

_tenpt

public void _tenpt()

_elevenpt

public void _elevenpt()

_twelvept

public void _twelvept()

_thirteenpt

public void _thirteenpt()

_fourteenpt

public void _fourteenpt()

_fifteenpt

public void _fifteenpt()

_sixteenpt

public void _sixteenpt()

_seventeenpt

public void _seventeenpt()

_eightteenpt

public void _eightteenpt()

_nineteenpt

public void _nineteenpt()

_twentypt

public void _twentypt()

_twentyonept

public void _twentyonept()

_twentytwopt

public void _twentytwopt()

_twentythreept

public void _twentythreept()

_twentyfourpt

public void _twentyfourpt()

_twentyfivept

public void _twentyfivept()

_twentysixpt

public void _twentysixpt()

_twentysevenpt

public void _twentysevenpt()

_twentyeightpt

public void _twentyeightpt()

_twentyninept

public void _twentyninept()

_thirtypt

public void _thirtypt()

_thirtyfivept

public void _thirtyfivept()

_fourtypt

public void _fourtypt()

_fourtyfivept

public void _fourtyfivept()

_fiftypt

public void _fiftypt()

_fiftyfivept

public void _fiftyfivept()

_sixtypt

public void _sixtypt()

_seventypt

public void _seventypt()

_eightypt

public void _eightypt()

_ninetypt

public void _ninetypt()

_hundredpt

public void _hundredpt()

_xpt

public void _xpt()

_xipt

public void _xipt()

_xiipt

public void _xiipt()

_xiiipt

public void _xiiipt()

_xivpt

public void _xivpt()

_xvpt

public void _xvpt()

_xvipt

public void _xvipt()

_xviipt

public void _xviipt()

_xviiipt

public void _xviiipt()

_xixpt

public void _xixpt()

_xxpt

public void _xxpt()

_xxipt

public void _xxipt()

_xxiipt

public void _xxiipt()

_xxiiipt

public void _xxiiipt()

_xxivpt

public void _xxivpt()

_xxvpt

public void _xxvpt()

_xxvipt

public void _xxvipt()

_xxviipt

public void _xxviipt()

_xxxpt

public void _xxxpt()

_xxxvpt

public void _xxxvpt()

_xlpt

public void _xlpt()

_tiny

public void _tiny()

_scriptsize

public void _scriptsize()

_footnotesize

public void _footnotesize()

_small

public void _small()

_normalsize

public void _normalsize()

_large

public void _large()

_Large

public void _Large()

_LARGE

public void _LARGE()

_huge

public void _huge()

_Huge

public void _Huge()

_hashsign

public void _hashsign()

_atsign

public void _atsign()

_lbracket

public void _lbracket()

_backslash

public void _backslash()

_rbracket

public void _rbracket()

_lbrace

public void _lbrace()

_verticalbar

public void _verticalbar()

_rbrace

public void _rbrace()

_tildechar

public void _tildechar()

_lesschar

public void _lesschar()

_equalchar

public void _equalchar()

_greaterchar

public void _greaterchar()

_arccos

public void _arccos()

_arcsin

public void _arcsin()

_arctan

public void _arctan()

_arg

public void _arg()

_atan

public void _atan()

_cos

public void _cos()

_cosh

public void _cosh()

_cot

public void _cot()

_coth

public void _coth()

_csc

public void _csc()

_deg

public void _deg()

_det

public void _det()

_dim

public void _dim()

_exp

public void _exp()

_gcd

public void _gcd()

_hom

public void _hom()

_inf

public void _inf()

_ker

public void _ker()

_lg

public void _lg()

_lim

public void _lim()

_liminf

public void _liminf()

_limsup

public void _limsup()

_ln

public void _ln()

_log

public void _log()

_max

public void _max()

_min

public void _min()

_Pr

public void _Pr()

_sec

public void _sec()

_sin

public void _sin()

_sinh

public void _sinh()

_sgn

public void _sgn()

_sup

public void _sup()

_tan

public void _tan()

_tanh

public void _tanh()

_alpha

public void _alpha()

_beta

public void _beta()

_gamma

public void _gamma()

_delta

public void _delta()

_epsilon

public void _epsilon()

_zeta

public void _zeta()

_eta

public void _eta()

_theta

public void _theta()

_iota

public void _iota()

_kappa

public void _kappa()

_lambda

public void _lambda()

_mu

public void _mu()

_nu

public void _nu()

_xi

public void _xi()

_greeko

public void _greeko()

_pi

public void _pi()

_rho

public void _rho()

_sigma

public void _sigma()

_tau

public void _tau()

_upsilon

public void _upsilon()

_phi

public void _phi()

_chi

public void _chi()

_psi

public void _psi()

_omega

public void _omega()

_varepsilon

public void _varepsilon()

_vartheta

public void _vartheta()

_varpi

public void _varpi()

_varrho

public void _varrho()

_varsigma

public void _varsigma()

_varphi

public void _varphi()

_Alpha

public void _Alpha()

_Beta

public void _Beta()

_Gamma

public void _Gamma()

_Delta

public void _Delta()

_Epsilon

public void _Epsilon()

_Zeta

public void _Zeta()

_Eta

public void _Eta()

_Theta

public void _Theta()

_Iota

public void _Iota()

_Kappa

public void _Kappa()

_Lambda

public void _Lambda()

_Mu

public void _Mu()

_Nu

public void _Nu()

_Xi

public void _Xi()

_Greeko

public void _Greeko()

_Pi

public void _Pi()

_Rho

public void _Rho()

_Sigma

public void _Sigma()

_Tau

public void _Tau()

_Upsilon

public void _Upsilon()

_Phi

public void _Phi()

_Chi

public void _Chi()

_Psi

public void _Psi()

_Omega

public void _Omega()

_calA

public void _calA()

_calB

public void _calB()

_calC

public void _calC()

_calD

public void _calD()

_calE

public void _calE()

_calF

public void _calF()

_calG

public void _calG()

_calH

public void _calH()

_calI

public void _calI()

_calJ

public void _calJ()

_calK

public void _calK()

_calL

public void _calL()

_calM

public void _calM()

_calN

public void _calN()

_calO

public void _calO()

_calP

public void _calP()

_calQ

public void _calQ()

_calR

public void _calR()

_calS

public void _calS()

_calT

public void _calT()

_calU

public void _calU()

_calV

public void _calV()

_calW

public void _calW()

_calX

public void _calX()

_calY

public void _calY()

_calZ

public void _calZ()

_aleph

public void _aleph()

_hbar

public void _hbar()

_imath

public void _imath()

_jmath

public void _jmath()

_ell

public void _ell()

_wp

public void _wp()

_Re

public void _Re()

_Im

public void _Im()

_partial

public void _partial()

_infty

public void _infty()

_prime

public void _prime()

_emptyset

public void _emptyset()

_nabla

public void _nabla()

_surd

public void _surd()

_top

public void _top()

_bot

public void _bot()

_doublebar

public void _doublebar()

_angle

public void _angle()

_triangle

public void _triangle()

_mbackslash

public void _mbackslash()

_forall

public void _forall()

_exists

public void _exists()

_neg

public void _neg()

_flat

public void _flat()

_natural

public void _natural()

_sharp

public void _sharp()

_clubsuit

public void _clubsuit()

_diamondsuit

public void _diamondsuit()

_heartsuit

public void _heartsuit()

_spadesuit

public void _spadesuit()

_oldstyle

public void _oldstyle()

_sum

public void _sum()

_prod

public void _prod()

_coprod

public void _coprod()

_int

public void _int()

_oint

public void _oint()

_bigcap

public void _bigcap()

_bigcup

public void _bigcup()

_bigsqcup

public void _bigsqcup()

_bigvee

public void _bigvee()

_bigwedge

public void _bigwedge()

_bigodot

public void _bigodot()

_bigotimes

public void _bigotimes()

_bigoplus

public void _bigoplus()

_biguplus

public void _biguplus()

_Sum

public int _Sum(java.lang.Object[] args)
sum symbol with super/subscripts above and below


_Sum_BEGIN

public void _Sum_BEGIN()

_Prod

public int _Prod(java.lang.Object[] args)
product symbol with super/subscripts above and below


_Prod_BEGIN

public void _Prod_BEGIN()

_Int

public int _Int(java.lang.Object[] args)
big integral symbol with super/subscripts above and below


_Int_BEGIN

public void _Int_BEGIN()

_lstack

public int _lstack(java.lang.Object[] args)

_cstack

public int _cstack(java.lang.Object[] args)

_rstack

public int _rstack(java.lang.Object[] args)

_frac

public int _frac(java.lang.Object[] args)

_minus

public void _minus()

_slash

public void _slash()

_pm

public void _pm()

_mp

public void _mp()

_setminus

public void _setminus()

_cdot

public void _cdot()

_cdotvar

public void _cdotvar()

_times

public void _times()

_ast

public void _ast()

_star

public void _star()

_diamond

public void _diamond()

_circ

public void _circ()

_bullet

public void _bullet()

_div

public void _div()

_cap

public void _cap()

_cup

public void _cup()

_uplus

public void _uplus()

_sqcap

public void _sqcap()

_sqcup

public void _sqcup()

_triangleleft

public void _triangleleft()

_triangleright

public void _triangleright()

_wr

public void _wr()

_bigcirc

public void _bigcirc()

_bigtriangleup

public void _bigtriangleup()

_bigtriangledown

public void _bigtriangledown()

_vee

public void _vee()

_wedge

public void _wedge()

_oplus

public void _oplus()

_ominus

public void _ominus()

_otimes

public void _otimes()

_oslash

public void _oslash()

_odot

public void _odot()

_dagger

public void _dagger()

_ddagger

public void _ddagger()

_amalg

public void _amalg()

_lessthan

public void _lessthan()

_greaterthan

public void _greaterthan()

_equals

public void _equals()

_leq

public void _leq()

_prec

public void _prec()

_preceq

public void _preceq()

_ll

public void _ll()

_subset

public void _subset()

_subseteq

public void _subseteq()

_sqsubseteq

public void _sqsubseteq()

_in

public void _in()

_vdash

public void _vdash()

_smile

public void _smile()

_frown

public void _frown()

_geq

public void _geq()

_succ

public void _succ()

_succeq

public void _succeq()

_gg

public void _gg()

_supset

public void _supset()

_supseteq

public void _supseteq()

_sqsupseteq

public void _sqsupseteq()

_ni

public void _ni()

_dashv

public void _dashv()

_mid

public void _mid()

_parallel

public void _parallel()

_equiv

public void _equiv()

_sim

public void _sim()

_simeq

public void _simeq()

_asymp

public void _asymp()

_approx

public void _approx()

_cong

public void _cong()

_bowtie

public void _bowtie()

_propto

public void _propto()

_models

public void _models()

_doteq

public void _doteq()

_perp

public void _perp()

_not

public void _not()
put a slash through the following relation symbol. As TeX itself, we forward to the approximate mid position of a relation, typeset a slash, then step backwards. Note that we do not check whether the following token is a symbol at all.


_notin

public void _notin()

_leftarrow

public void _leftarrow()

_Leftarrow

public void _Leftarrow()

_rightarrow

public void _rightarrow()

_Rightarrow

public void _Rightarrow()

_leftrightarrow

public void _leftrightarrow()

_Leftrightarrow

public void _Leftrightarrow()

_mapsto

public void _mapsto()

_hookleftarrow

public void _hookleftarrow()

_leftharpoonup

public void _leftharpoonup()

_leftharpoondown

public void _leftharpoondown()

_rightleftharpoons

public void _rightleftharpoons()

_longleftarrow

public void _longleftarrow()

_Longleftarrow

public void _Longleftarrow()

_longrightarrow

public void _longrightarrow()

_Longrightarrow

public void _Longrightarrow()

_longleftrightarrow

public void _longleftrightarrow()

_Longleftrightarrow

public void _Longleftrightarrow()

_longmapsto

public void _longmapsto()

_hookrightarrow

public void _hookrightarrow()

_rightharpoonup

public void _rightharpoonup()

_rightharpoondown

public void _rightharpoondown()

_uparrow

public void _uparrow()

_Uparrow

public void _Uparrow()

_downarrow

public void _downarrow()

_Downarrow

public void _Downarrow()

_updownarrow

public void _updownarrow()

_Updownarrow

public void _Updownarrow()

_nearrow

public void _nearrow()

_searrow

public void _searrow()

_swarrow

public void _swarrow()

_nwarrow

public void _nwarrow()

_buildrel

public void _buildrel()

_looparrowleft

public void _looparrowleft()

_looparrowright

public void _looparrowright()

_leftrightsquigarrow

public void _leftrightsquigarrow()

_circlearrowleft

public void _circlearrowleft()

_circlearrowright

public void _circlearrowright()

_nleftarrow

public void _nleftarrow()

_nrightarrow

public void _nrightarrow()

_nleftrightarrow

public void _nleftrightarrow()

_nLeftarrow

public void _nLeftarrow()

_nLeftrightarrow

public void _nLeftrightarrow()

_nRightarrow

public void _nRightarrow()

_lbrack

public void _lbrack()

_lfloor

public void _lfloor()

_lceil

public void _lceil()

_langle

public void _langle()

_lmoustache

public void _lmoustache()

_lgroup

public void _lgroup()

_rbrack

public void _rbrack()

_rfloor

public void _rfloor()

_rceil

public void _rceil()

_rangle

public void _rangle()

_rmoustache

public void _rmoustache()

_rgroup

public void _rgroup()

_arrowvert

public void _arrowvert()

_Arrowvert

public void _Arrowvert()

_bracevert

public void _bracevert()

_colon

public void _colon()

_ldots

public void _ldots()

_cdots

public void _cdots()

_ne

public void _ne()

_neq

public void _neq()

_le

public void _le()

_ge

public void _ge()

_to

public void _to()

_gets

public void _gets()

_owns

public void _owns()

_land

public void _land()

_lor

public void _lor()

_lnot

public void _lnot()

_vert

public void _vert()

_Vert

public void _Vert()

_iff

public void _iff()

_S

public void _S()

_P

public void _P()

_dag

public void _dag()

_ddag

public void _ddag()

_sqsubset

public void _sqsubset()

_define

public void _define()

_Join

public void _Join()

_sqsupset

public void _sqsupset()

_vdots

public void _vdots()

_ddots

public void _ddots()

_Box

public void _Box()

_Diamond

public void _Diamond()

_mho

public void _mho()

_euro

public void _euro()

_pound

public void _pound()

_pts

public void _pts()

_setZ

public void _setZ()

_setN

public void _setN()

_setR

public void _setR()

_celsius

public void _celsius()

_fahrenheit

public void _fahrenheit()

_complement

public void _complement()

_nexists

public void _nexists()

_varnothing

public void _varnothing()

_mathslash

public void _mathslash()

_root

public void _root()

_cubicroot

public void _cubicroot()

_fourthroot

public void _fourthroot()

_varpropto

public void _varpropto()

_lhd

public void _lhd()

_rhd

public void _rhd()

_unlhd

public void _unlhd()

_unrhd

public void _unrhd()

_iint

public void _iint()

_iiint

public void _iiint()

_telephone

public void _telephone()

_smiley

public void _smiley()

_smileyblack

public void _smileyblack()

_male

public void _male()

_female

public void _female()

_proportional

public void _proportional()

_approxeq

public void _approxeq()

_pmb

public int _pmb()

_hat

public int _hat(java.lang.Object[] a)

_check

public int _check(java.lang.Object[] a)

_acute

public int _acute(java.lang.Object[] a)

_grave

public int _grave(java.lang.Object[] a)

_bar

public int _bar(java.lang.Object[] a)

_vec

public int _vec(java.lang.Object[] a)

_dot

public int _dot(java.lang.Object[] a)

_ddot

public int _ddot(java.lang.Object[] a)

_tilde

public int _tilde(java.lang.Object[] a)

_dq

public int _dq(java.lang.Object[] a)

accent

public int accent(java.lang.String cmd,
                  java.lang.Object[] args)
if called with args=null, return number of expected arguments, i.e. 1. If args[] is non-null create a StackBox with the accented character. FIXME: (accent): should check for and respect italic correction...


_widetilde

public void _widetilde()

_widehat

public void _widehat()

_overleftarrow

public void _overleftarrow()

_overrightarrow

public void _overrightarrow()

_overbrace

public int _overbrace()

_underbrace

public int _underbrace()

_over

public void _over()

_sqrtn

public int _sqrtn()

_underline

public int _underline(java.lang.Object[] args)

_overline

public int _overline(java.lang.Object[] args)

_sqrt

public int _sqrt(java.lang.Object[] args)

_digamma

public void _digamma()

_beth

public void _beth()

_daleth

public void _daleth()

_gimel

public void _gimel()

_lll

public void _lll()

_ggg

public void _ggg()

_percent

public void _percent()

_promille

public void _promille()

_copyright

public void _copyright()

_paragraph

public void _paragraph()

_degrees

public void _degrees()

_square

public void _square()

_not_internal

public void _not_internal()

_ldots_internal

public void _ldots_internal()

_cdots_internal

public void _cdots_internal()

_strut

public void _strut()

__space

public void __space(int pixels)

_thinspace

public void _thinspace()

_mskip_thin

public void _mskip_thin()

_mskip_med

public void _mskip_med()

_mskip_thick

public void _mskip_thick()

_mskip_back

public void _mskip_back()

_qquad

public void _qquad()

_emspace

public void _emspace()

__make_line

public LP2.Box __make_line(double x,
                           double y,
                           double width)
create a thin horizontal line of the given width (i.e. length, not thickness) by concatenating CMR "-" symbols. Therefore, the minimum line width is the width of one "-" character. We add a little back-spacing between "-" characters to ensure those critters actually overlap... Finally, if CMR is not available we fall back to Times "-". The current values of ptSize and colorIndex are used.


greek

void greek(java.lang.String s)

greek

void greek(java.lang.String s,
           int cmfont,
           int c)

calli

void calli(java.lang.String s,
           int cmfont,
           int c)

unicode

void unicode(java.lang.String s,
             int cmfont1,
             int c1,
             int cmfont2,
             int c2,
             int dx)

unicode

void unicode(java.lang.String s,
             int cmfont,
             int c)

unicode

void unicode(java.lang.String s)

big_opr

void big_opr(java.lang.String s,
             int cmfont,
             int c)
big operator symbol, no display-math super/subscripts yet


binaryop

void binaryop(java.lang.String s,
              int cmfont,
              int c)
thinspace, operator, thinspace


relation

void relation(java.lang.String s,
              int cmfont,
              int c)
thinspace, operator, thinspace


relation

void relation(java.lang.String s,
              int cmfont1,
              int c1,
              int cmfont2,
              int c2,
              int dx)

mathfunction

void mathfunction(java.lang.String s)

space

void space(int points)

writeFigHeader

void writeFigHeader(java.io.PrintStream ps)

setFontIndex

public void setFontIndex(int fontIndex)

setFontPtSize

public void setFontPtSize(int ptSize)

setColorIndex

public void setColorIndex(int colorIndex)

parse

public void parse(java.lang.String s)

convertToFig

public void convertToFig(FigCompound compound)

selftest

public void selftest(java.lang.String s)

setEnableDisplayBoxes

public void setEnableDisplayBoxes(boolean b)

setEnableDumpTokens

public void setEnableDumpTokens(boolean b)

setUseWords

public void setUseWords(boolean b)
whether or not to concatenate CharBoxes with matching attributes


msg

public static void msg(java.lang.String s)

usage

public static void usage()

main

public static void main(java.lang.String[] argv)