Class Ifhmode

  extended by org.extex.interpreter.type.AbstractCode
      extended by org.extex.unit.base.conditional.AbstractIf
          extended by org.extex.unit.tex.conditional.Ifhmode
All Implemented Interfaces:, Code, ExpandableCode, PrefixCode

public class Ifhmode
extends AbstractIf

This class provides an implementation for the primitive \ifhmode.

The Primitive \ifhmode

The primitive does not take any further arguments. The conditional is true iff the typesetter is in a horizontal mode. This is either the restricted horizontal vertical mode or the horizontal mode.


The formal description of this primitive is the following:
      → \ifhmode ⟨true text⟩ \fi
      | \ifhmode ⟨true text⟩ \else ⟨false text⟩ \fi 


    \ifhmode abc \fi  

$Revision: 4439 $
Gerd Neugebauer
See Also:
Serialized Form

Field Summary
protected static long serialVersionUID
          The constant serialVersionUID contains the id for serialization.
Constructor Summary
Ifhmode(CodeToken token)
          Creates a new object.
Method Summary
 boolean conditional(Context context, TokenSource source, Typesetter typesetter)
          This method computes the boolean value of the conditional.
Methods inherited from class org.extex.unit.base.conditional.AbstractIf
execute, expand, getMyLocalizer, isIf, skipToElseOrFi
Methods inherited from class org.extex.interpreter.type.AbstractCode
getLocalizer, getName, getToken, isOuter, readResolve, toString, toText, toText
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


protected static final long serialVersionUID
The constant serialVersionUID contains the id for serialization.

See Also:
Constant Field Values
Constructor Detail


public Ifhmode(CodeToken token)
Creates a new object.

token - the initial token for the primitive
Method Detail


public boolean conditional(Context context,
                           TokenSource source,
                           Typesetter typesetter)
                    throws HelpingException
This method computes the boolean value of the conditional. If the result is true then the then branch is expanded and the else branch is skipped. Otherwise the then branch is skipped and the else branch is expanded.

Specified by:
conditional in class AbstractIf
context - the interpreter context
source - the source for new tokens
typesetter - the typesetter
the boolean value
HelpingException - in case of an error
See Also:
AbstractIf.conditional( org.extex.interpreter.context.Context, org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)