de.dante.extex.typesetter.listMaker.math
Class MathListMaker

java.lang.Object
  extended byde.dante.extex.typesetter.listMaker.AbstractListMaker
      extended byde.dante.extex.typesetter.listMaker.HorizontalListMaker
          extended byde.dante.extex.typesetter.listMaker.math.MathListMaker
All Implemented Interfaces:
ListMaker, LogEnabled, NoadConsumer
Direct Known Subclasses:
DisplaymathListMaker

public class MathListMaker
extends HorizontalListMaker
implements NoadConsumer, LogEnabled

This is the list maker for the inline math formulae.

The Dimen Parameter \mathsurround

The dimen parameter \mathsurround is used to put some spacing around mathematical formulae. The value at the end of the formula is used before and after the formula. This additional space will be discarded at the end of a line.

The Tokens Parameter \everymath

The tokens parameter \everymath contains a list of tokens which is inserted at the beginning of inline math. Those tokens take effect after the math mode has been entered but before any tokens given explicitly.

Syntax

The formal description of this primitive is the following:
    ⟨everymath⟩
      → \everymath ⟨equals⟩ ⟨tokens⟩  

Examples

    \everymath={\,}  

The Tokens Parameter \everymathend

The tokens parameter \everymathend contains a list of tokens which is inserted at the end of inline math. Those tokens take effect just before the math mode is ended but after any tokens given explicitly.

Syntax

The formal description of this primitive is the following:
    ⟨everymathend⟩
      → \everymathend ⟨equals⟩ ⟨tokens⟩  

Examples

    \everymathend={\,}  

Version:
$Revision: 1.54 $
Author:
Gerd Neugebauer

Constructor Summary
MathListMaker(ListManager manager, Locator locator)
          Creates a new object.
 
Method Summary
 void add(FixedDimen g)
           
 void add(MathCode mc, TypesettingContext tc)
          Add a mathematical glyph.
 void add(MathDelimiter delimiter, TypesettingContext tc)
          Add a mathematical delimiter.
 void add(Mudimen skip)
          Add some math dimen Noad to the internal list.
 void add(Muskip glue)
          Add some math glue Noad to the internal list.
 void add(Noad noad)
          Add an arbitrary Noad to the internal list if it is prepared to hold one.
 void add(Node node)
          Add an arbitrary node to the internal list of nodes gathered so far.
 void addSpace(TypesettingContext typesettingContext, Count spacefactor)
          Spaces are ignored in math mode.
 NodeList complete(TypesetterOptions context)
          Close the node list.
 void cr(Context context, TypesettingContext tc, UnicodeChar uc)
          Process a carriage return.
 void enableLogging(java.util.logging.Logger log)
          Setter for the logger.
protected  Noad getInsertionPoint()
          Getter for the contents of the insertion point.
 Noad getLastNoad()
          Get access to the previous noad.
 Node getLastNode()
          Access the last node on the list.
 java.util.logging.Logger getLogger()
          Getter for logger.
 Mode getMode()
          Getter for the current mode.
protected  Noad getNoads()
          Getter for Noads.
protected static boolean insufficientExtensionFonts(TypesetterOptions options)
          This method checks that extension fonts have sufficient font dimen values set.
protected static boolean insufficientSymbolFonts(TypesetterOptions options)
          This method checks that symbol fonts have sufficient font dimen values set.
protected  boolean isClosing()
          Getter for closing.
 void left(MathDelimiter delimiter)
          Open the group for a \left-\right construction.
 void leftBrace()
          Notification method to deal the case that a left brace has been encountered.
 boolean letter(UnicodeChar symbol, TypesettingContext tc, Context context, TokenSource source, Locator locator)
          Add a letter to the current list or treat it in some other appropriate way.
 void mathShift(Context context, TokenSource source, Token t)
          Treat a math shift character.
 void middle(MathDelimiter delimiter)
          Middle in the group for a \left-\right construction.
 void par()
          Emitting a new paragraph is not supported in math mode.
 void removeLastNode()
          Removes the last node from the list.
 void right(MathDelimiter delimiter)
          Close the group for a \left-\right construction.
 void rightBrace()
          Notification method to deal the case that a right brace has been encountered.
 Noad scanNoad(Flags flags, Context context, TokenSource source, Typesetter typesetter, java.lang.String primitive)
          Process the input until a Noad is completed.
protected  void setClosing(boolean closing)
          Setter for closing.
protected  void setInsertionPoint(MathList insertionPoint)
          Setter for insertionPoint.
 void showlist(java.lang.StringBuffer sb, long l, long m)
          Print the status for \showlists.
 void subscriptMark(Context context, TokenSource source, Typesetter typesetter, Token token)
          Treat a subscript mark.
 void superscriptMark(Context context, TokenSource source, Typesetter typesetter, Token token)
          Treat a superscript mark.
 void switchToFraction(MathDelimiter leftDelimiter, MathDelimiter rightDelimiter, FixedDimen ruleWidth, TypesettingContext tc)
          This method instructs the implementing class to use a fraction construction.
 
Methods inherited from class de.dante.extex.typesetter.listMaker.HorizontalListMaker
add, addAndAdjust, afterParagraph, getNodes, getSpacefactor, setNodes, setSpacefactor, toString
 
Methods inherited from class de.dante.extex.typesetter.listMaker.AbstractListMaker
getLocalizer, getLocator, getManager, getMyLocalizer, getPrevDepth, setPrevDepth, tab
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.dante.extex.typesetter.ListMaker
add, addAndAdjust, afterParagraph, getLocator, getPrevDepth, getSpacefactor, setPrevDepth, setSpacefactor, tab
 

Constructor Detail

MathListMaker

public MathListMaker(ListManager manager,
                     Locator locator)
Creates a new object.

Parameters:
manager - the manager to ask for global changes
locator - the locator
Method Detail

insufficientExtensionFonts

protected static boolean insufficientExtensionFonts(TypesetterOptions options)
This method checks that extension fonts have sufficient font dimen values set.

Parameters:
options - the options
Returns:
true iff the needed font dimens are not present
See Also:
"[TTP 1195]"

insufficientSymbolFonts

protected static boolean insufficientSymbolFonts(TypesetterOptions options)
This method checks that symbol fonts have sufficient font dimen values set. In fact only the fonts itself are checked. the font dimens are checked when needed.

Parameters:
options - the options
Returns:
true iff the symbol fonts have the needed font dimens
See Also:
"[TTP 1195]"

add

public void add(FixedDimen g)
         throws TypesetterException
Throws:
TypesetterException
See Also:
ListMaker.add( de.dante.extex.interpreter.type.glue.FixedGlue)

add

public void add(MathCode mc,
                TypesettingContext tc)
         throws TypesetterException
Description copied from interface: NoadConsumer
Add a mathematical glyph.

Specified by:
add in interface NoadConsumer
Parameters:
mc - the math code
tc - the typesetting context
Throws:
TypesetterException - in case of an error
See Also:
NoadConsumer.add( de.dante.extex.interpreter.type.math.MathCode, de.dante.extex.interpreter.context.tc.TypesettingContext)

add

public void add(MathDelimiter delimiter,
                TypesettingContext tc)
         throws TypesetterException
Description copied from interface: NoadConsumer
Add a mathematical delimiter.

Specified by:
add in interface NoadConsumer
Parameters:
delimiter - the delimiter
tc - the typesetting context
Throws:
TypesetterException - in case of an error
See Also:
de.dante.extex.typesetter.listMaker.math.NoadConsumer#add( de.dante.extex.typesetter.type.math.MathDelimiter, de.dante.extex.interpreter.context.TypesettingContext)

add

public void add(Mudimen skip)
         throws TypesetterException
Description copied from interface: NoadConsumer
Add some math dimen Noad to the internal list.

Specified by:
add in interface NoadConsumer
Parameters:
skip - the length to add
Throws:
TypesetterException - in case of an error
See Also:
NoadConsumer.add( de.dante.extex.interpreter.type.muskip.Mudimen)

add

public void add(Muskip glue)
         throws TypesetterException
Description copied from interface: NoadConsumer
Add some math glue Noad to the internal list.

Specified by:
add in interface NoadConsumer
Parameters:
glue - the glue to add
Throws:
TypesetterException - in case of an error
See Also:
NoadConsumer.add( de.dante.extex.interpreter.type.muskip.Muskip)

add

public void add(Noad noad)
         throws TypesetterException
Description copied from interface: NoadConsumer
Add an arbitrary Noad to the internal list if it is prepared to hold one. This is usually the case in math modes.

Specified by:
add in interface NoadConsumer
Parameters:
noad - the noad to add
Throws:
TypesetterException - in case of an error
See Also:
NoadConsumer.add( de.dante.extex.typesetter.type.noad.Noad)

add

public void add(Node node)
         throws TypesetterException,
                ConfigurationException
Description copied from interface: ListMaker
Add an arbitrary node to the internal list of nodes gathered so far. The node should not be one of the special nodes treated by methods of their own.

Specified by:
add in interface ListMaker
Overrides:
add in class HorizontalListMaker
Throws:
TypesetterException
ConfigurationException
See Also:
ListMaker.add( de.dante.extex.typesetter.type.Node)

addSpace

public void addSpace(TypesettingContext typesettingContext,
                     Count spacefactor)
              throws TypesetterException,
                     ConfigurationException
Spaces are ignored in math mode. Thus this method is a noop.

Specified by:
addSpace in interface ListMaker
Overrides:
addSpace in class HorizontalListMaker
Parameters:
typesettingContext - the typesetting context for the space
spacefactor - the space factor to use for this space or null to indicate that the default space factor should be used.
Throws:
TypesetterException - in case of an error
ConfigurationException - in case of a configuration error
See Also:
de.dante.extex.typesetter.ListMaker#addSpace( de.dante.extex.interpreter.context.TypesettingContext, de.dante.extex.interpreter.type.count.Count)

complete

public NodeList complete(TypesetterOptions context)
                  throws TypesetterException,
                         ConfigurationException
Close the node list. In the course of the closing, the Noad list is translated into a Node list.

Specified by:
complete in interface ListMaker
Overrides:
complete in class HorizontalListMaker
Parameters:
context - the fragment of the context accessible for the typesetter
Returns:
the node list enclosed in this instance
Throws:
TypesetterException - in case of an error
ConfigurationException - in case of a configuration error
See Also:
ListMaker.complete(TypesetterOptions), "TeX – The Program [719]"

cr

public void cr(Context context,
               TypesettingContext tc,
               UnicodeChar uc)
        throws TypesetterException
Description copied from interface: ListMaker
Process a carriage return.

Specified by:
cr in interface ListMaker
Overrides:
cr in class HorizontalListMaker
Throws:
TypesetterException
See Also:
de.dante.extex.typesetter.ListMaker#cr( de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.context.TypesettingContext, de.dante.util.UnicodeChar)

enableLogging

public void enableLogging(java.util.logging.Logger log)
Description copied from interface: LogEnabled
Setter for the logger.

Specified by:
enableLogging in interface LogEnabled
Parameters:
log - the logger to use
See Also:
LogEnabled.enableLogging( java.util.logging.Logger)

getInsertionPoint

protected Noad getInsertionPoint()
Getter for the contents of the insertion point. If the insertion point does not contain an element then null is returned. If it contains only one element then this element is returned. Otherwise the complete list is returned.

Returns:
the contents of the insertion point

getLastNoad

public Noad getLastNoad()
                 throws TypesetterException
Description copied from interface: NoadConsumer
Get access to the previous noad.

Specified by:
getLastNoad in interface NoadConsumer
Returns:
the previous noad or null if there is none
Throws:
TypesetterException - in case of an error
See Also:
NoadConsumer.getLastNoad()

getLastNode

public Node getLastNode()
Description copied from interface: ListMaker
Access the last node on the list.

Specified by:
getLastNode in interface ListMaker
Overrides:
getLastNode in class HorizontalListMaker
See Also:
ListMaker.getLastNode()

getLogger

public java.util.logging.Logger getLogger()
Getter for logger.

Returns:
the logger

getMode

public Mode getMode()
Description copied from interface: ListMaker
Getter for the current mode.

Specified by:
getMode in interface ListMaker
Overrides:
getMode in class HorizontalListMaker
See Also:
ListMaker.getMode()

getNoads

protected Noad getNoads()
Getter for Noads.

Returns:
the Noads.

isClosing

protected boolean isClosing()
Getter for closing.

Returns:
the closing

left

public void left(MathDelimiter delimiter)
          throws TypesetterException
Description copied from interface: NoadConsumer
Open the group for a \left-\right construction.

Specified by:
left in interface NoadConsumer
Parameters:
delimiter - the delimiter to typeset on theleft side
Throws:
TypesetterException - in case of an error
See Also:
de.dante.extex.typesetter.listMaker.math.NoadConsumer#left( de.dante.extex.typesetter.type.math.MathDelimiter)

leftBrace

public void leftBrace()
Notification method to deal the case that a left brace has been encountered.

Specified by:
leftBrace in interface ListMaker
Overrides:
leftBrace in class AbstractListMaker
See Also:
ListMaker.leftBrace()

letter

public boolean letter(UnicodeChar symbol,
                      TypesettingContext tc,
                      Context context,
                      TokenSource source,
                      Locator locator)
               throws TypesetterException
Description copied from interface: ListMaker
Add a letter to the current list or treat it in some other appropriate way.

Specified by:
letter in interface ListMaker
Overrides:
letter in class HorizontalListMaker
Parameters:
symbol - the symbol to add
tc - the typesetting context for the symbol
context - the interpreter context
source - the source of new tokens
locator - the locator
Throws:
TypesetterException
See Also:
ListMaker.letter( de.dante.util.UnicodeChar, de.dante.extex.interpreter.context.tc.TypesettingContext, de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.TokenSource, de.dante.util.Locator)

mathShift

public void mathShift(Context context,
                      TokenSource source,
                      Token t)
               throws TypesetterException,
                      ConfigurationException
Description copied from interface: ListMaker
Treat a math shift character. Usually this leads to entering or leaving math mode – maybe after inspection of a following token.

Specified by:
mathShift in interface ListMaker
Overrides:
mathShift in class AbstractListMaker
Throws:
TypesetterException
ConfigurationException
See Also:
ListMaker.mathShift( de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.TokenSource, de.dante.extex.scanner.type.token.Token)

middle

public void middle(MathDelimiter delimiter)
            throws TypesetterException
Description copied from interface: NoadConsumer
Middle in the group for a \left-\right construction.

Specified by:
middle in interface NoadConsumer
Parameters:
delimiter - the delimiter to typeset here
Throws:
TypesetterException - in case of an error
See Also:
de.dante.extex.typesetter.listMaker.math.NoadConsumer#middle( de.dante.extex.typesetter.type.math.MathDelimiter)

par

public void par()
         throws TypesetterException,
                ConfigurationException
Emitting a new paragraph is not supported in math mode. Thus an exception is thrown.

Specified by:
par in interface ListMaker
Overrides:
par in class HorizontalListMaker
Throws:
TypesetterException - in case of an error
ConfigurationException - in case of an configuration error
See Also:
ListMaker.par(), "TeX – The Program [1047]"

removeLastNode

public void removeLastNode()
Description copied from interface: ListMaker
Removes the last node from the list. If the list is empty then nothing is done.

Specified by:
removeLastNode in interface ListMaker
Overrides:
removeLastNode in class HorizontalListMaker
See Also:
ListMaker.removeLastNode()

right

public void right(MathDelimiter delimiter)
           throws TypesetterException
Description copied from interface: NoadConsumer
Close the group for a \left-\right construction.

Specified by:
right in interface NoadConsumer
Parameters:
delimiter - the delimiter to typeset on the right side
Throws:
TypesetterException - in case of an error
See Also:
de.dante.extex.typesetter.listMaker.math.NoadConsumer#right( de.dante.extex.typesetter.type.math.MathDelimiter)

rightBrace

public void rightBrace()
                throws TypesetterException
Description copied from interface: ListMaker
Notification method to deal the case that a right brace has been encountered.

Specified by:
rightBrace in interface ListMaker
Overrides:
rightBrace in class AbstractListMaker
Throws:
TypesetterException
See Also:
ListMaker.rightBrace()

scanNoad

public Noad scanNoad(Flags flags,
                     Context context,
                     TokenSource source,
                     Typesetter typesetter,
                     java.lang.String primitive)
              throws TypesetterException
Description copied from interface: NoadConsumer
Process the input until a Noad is completed. A Noad is either a single Noad or a list of Noads resulting from the processing of a block.

Specified by:
scanNoad in interface NoadConsumer
Parameters:
flags - the flags to restore after processing
context - the interpreter context
source - the source for new tokens
typesetter - the typesetter
primitive - the name of the primitive for error messages
Returns:
the Noad read or null if none could be gathered
Throws:
TypesetterException - in case of an error
See Also:
NoadConsumer.scanNoad( de.dante.extex.interpreter.Flags, de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.TokenSource, de.dante.extex.typesetter.Typesetter, java.lang.String)

setClosing

protected void setClosing(boolean closing)
Setter for closing.

Parameters:
closing - the closing to set

setInsertionPoint

protected void setInsertionPoint(MathList insertionPoint)
Setter for insertionPoint.

Parameters:
insertionPoint - the insertionPoint to set

showlist

public void showlist(java.lang.StringBuffer sb,
                     long l,
                     long m)
Description copied from interface: ListMaker
Print the status for \showlists.

Specified by:
showlist in interface ListMaker
Overrides:
showlist in class HorizontalListMaker
See Also:
ListMaker.showlist( java.lang.StringBuffer, long, long)

subscriptMark

public void subscriptMark(Context context,
                          TokenSource source,
                          Typesetter typesetter,
                          Token token)
                   throws TypesetterException
Description copied from interface: ListMaker
Treat a subscript mark. This might be meaningful in math mode only.

Specified by:
subscriptMark in interface ListMaker
Overrides:
subscriptMark in class AbstractListMaker
Throws:
TypesetterException
See Also:
ListMaker.subscriptMark( de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.TokenSource, Typesetter, de.dante.extex.scanner.type.token.Token)

superscriptMark

public void superscriptMark(Context context,
                            TokenSource source,
                            Typesetter typesetter,
                            Token token)
                     throws TypesetterException
Description copied from interface: ListMaker
Treat a superscript mark. This might be meaningful in math mode only.

Specified by:
superscriptMark in interface ListMaker
Overrides:
superscriptMark in class AbstractListMaker
Throws:
TypesetterException
See Also:
ListMaker.superscriptMark( de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.TokenSource, Typesetter, de.dante.extex.scanner.type.token.Token)

switchToFraction

public void switchToFraction(MathDelimiter leftDelimiter,
                             MathDelimiter rightDelimiter,
                             FixedDimen ruleWidth,
                             TypesettingContext tc)
                      throws TypesetterException
Description copied from interface: NoadConsumer
This method instructs the implementing class to use a fraction construction. The math list collected so far is integrated into the fraction noad.

Specified by:
switchToFraction in interface NoadConsumer
Parameters:
leftDelimiter - the left delimiter or null if none should be used.
rightDelimiter - the right delimiter or null if none should be used.
ruleWidth - th width of the rule or null to indicate that the default width should be used
Throws:
TypesetterException - in case of an error
See Also:
de.dante.extex.typesetter.listMaker.math.NoadConsumer#switchToFraction( de.dante.extex.typesetter.type.math.MathDelimiter, de.dante.extex.typesetter.type.math.MathDelimiter, de.dante.extex.interpreter.type.dimen.FixedDimen, de.dante.extex.interpreter.context.TypesettingContext)