Example #1
0
 public FractionAtom(Atom numerator, Atom denominator, TexUnit unit, double thickness,
     TexAlignment numeratorAlignment, TexAlignment denominatorAlignment)
     : this(numerator, denominator, unit, thickness)
 {
     this.numeratorAlignment = CheckAlignment(numeratorAlignment);
     this.denominatorAlignment = CheckAlignment(denominatorAlignment);
 }
Example #2
0
 public FractionAtom(Atom numerator, Atom denominator, bool drawLine,
     TexAlignment numeratorAlignment, TexAlignment denominatorAlignment)
     : this(numerator, denominator, drawLine)
 {
     this.numeratorAlignment = CheckAlignment(numeratorAlignment);
     this.denominatorAlignment = CheckAlignment(denominatorAlignment);
 }
Example #3
0
        public UnderOverAtom(Atom baseAtom, Atom underOver, TexUnit underOverUnit, double underOverSpace,
            bool underOverScriptSize, bool over)
        {
            SpaceAtom.CheckUnit(underOverUnit);

            this.BaseAtom = baseAtom;

            if (over)
            {
                this.UnderAtom = null;
                this.UnderSpace = 0;
                this.UnderSpaceUnit = 0;
                this.UnderScriptSmaller = false;
                this.OverAtom = underOver;
                this.OverSpaceUnit = underOverUnit;
                this.OverSpace = underOverSpace;
                this.OverScriptSmaller = underOverScriptSize;
            }
            else
            {
                this.UnderAtom = underOver;
                this.UnderSpaceUnit = underOverUnit;
                this.UnderSpace = underOverSpace;
                this.UnderScriptSmaller = underOverScriptSize;
                this.OverSpace = 0;
                this.OverAtom = null;
                this.OverSpaceUnit = 0;
                this.OverScriptSmaller = false;
            }
        }
Example #4
0
 public ScriptsAtom(Atom baseAtom, Atom subscriptAtom, Atom superscriptAtom)
     : base()
 {
     this.BaseAtom = baseAtom;
     this.SubscriptAtom = subscriptAtom;
     this.SuperscriptAtom = superscriptAtom;
 }
Example #5
0
 public PhantomAtom(Atom baseAtom, bool useWidth, bool useHeight, bool useDepth)
     : base()
 {
     this.RowAtom = baseAtom == null ? new RowAtom() : new RowAtom(baseAtom);
     this.useWidth = useWidth;
     this.useHeight = useHeight;
     this.useDepth = useDepth;
 }
Example #6
0
 public BigOperatorAtom(Atom baseAtom, Atom lowerLimitAtom, Atom upperLimitAtom)
 {
     this.Type = TexAtomType.BigOperator;
     this.BaseAtom = baseAtom;
     this.LowerLimitAtom = lowerLimitAtom;
     this.UpperLimitAtom = upperLimitAtom;
     this.UseVerticalLimits = null;
 }
Example #7
0
        public AccentedAtom(Atom baseAtom, string accentName)
        {
            this.BaseAtom = baseAtom;
            this.AccentAtom = SymbolAtom.GetAtom(accentName);

            if (this.AccentAtom.Type != TexAtomType.Accent)
                throw new ArgumentException("The specified symbol name is not an accent.", "accent");
        }
Example #8
0
        public AccentedAtom(Atom baseAtom, TexFormula accent)
        {
            var rootSymbol = accent.RootAtom as SymbolAtom;
            if (rootSymbol == null)
                throw new ArgumentException("The formula for the accent is not a single symbol.", "accent");
            this.AccentAtom = (SymbolAtom)rootSymbol;

            if (this.AccentAtom.Type != TexAtomType.Accent)
                throw new ArgumentException("The specified symbol name is not an accent.", "accent");
        }
Example #9
0
 public void SetBackground(Brush brush)
 {
     if (this.RootAtom is StyledAtom)
     {
         this.RootAtom = ((StyledAtom)this.RootAtom).Clone();
         ((StyledAtom)this.RootAtom).Background = brush;
     }
     else
     {
         this.RootAtom = new StyledAtom(this.RootAtom, brush, null);
     }
 }
Example #10
0
        protected FractionAtom(Atom numerator, Atom denominator, bool useDefaultThickness, TexUnit unit, double thickness)
        {
            SpaceAtom.CheckUnit(unit);

            this.Type = TexAtomType.Inner;
            this.Numerator = numerator;
            this.Denominator = denominator;
            this.numeratorAlignment = TexAlignment.Center;
            this.denominatorAlignment = TexAlignment.Center;
            this.useDefaultThickness = useDefaultThickness;
            this.lineThicknessUnit = unit;
            this.lineThickness = thickness;
        }
Example #11
0
 public RowAtom(Atom baseAtom)
     : this()
 {
     if (baseAtom != null)
     {
         if (baseAtom is RowAtom)
         {
             foreach (var atom in ((RowAtom)baseAtom).Elements)
                 this.Elements.Add(atom);
         }
         else
         {
             this.Elements.Add(baseAtom);
         }
     }
 }
Example #12
0
        public UnderOverAtom(Atom baseAtom, Atom under, TexUnit underUnit, double underSpace, bool underScriptSize,
            Atom over, TexUnit overUnit, double overSpace, bool overScriptSize)
        {
            SpaceAtom.CheckUnit(underUnit);
            SpaceAtom.CheckUnit(overUnit);

            this.BaseAtom = baseAtom;
            this.UnderAtom = under;
            this.UnderSpaceUnit = underUnit;
            this.UnderSpace = underSpace;
            this.UnderScriptSmaller = underScriptSize;
            this.OverAtom = over;
            this.OverSpaceUnit = overUnit;
            this.OverSpace = overSpace;
            this.OverScriptSmaller = overScriptSize;
        }
Example #13
0
 public PhantomAtom(Atom baseAtom)
     : this(baseAtom, true, true, true)
 {
 }
Example #14
0
 public void Add(Atom atom)
 {
     this.Formula.Add(atom);
 }
Example #15
0
 public VerticalCenteredAtom(Atom atom)
 {
     this.Atom = atom;
 }
Example #16
0
 public Radical(Atom baseAtom, Atom degreeAtom = null)
     : base()
 {
     this.BaseAtom = baseAtom;
     this.DegreeAtom = degreeAtom;
 }
Example #17
0
        private Atom AttachScripts(TexFormula formula, string value, ref int position, Atom atom)
        {
            SkipWhiteSpace(value, ref position);

            if (position == value.Length)
                return atom;

            // Check for prime marks.
            var primesRowAtom = new RowAtom();
            int i = position;
            while (i < value.Length)
            {
                if (value[i] == primeChar)
                {
                    primesRowAtom.Add(SymbolAtom.GetAtom("prime"));
                    position++;
                }
                else if (!IsWhiteSpace(value[i]))
                    break;
                i++;
            }

            if (primesRowAtom.Elements.Count > 0)
                atom = new ScriptsAtom(atom, null, primesRowAtom);

            if (position == value.Length)
                return atom;

            TexFormula superscriptFormula = null;
            TexFormula subscriptFormula = null;

            var ch = value[position];
            if (ch == superScriptChar)
            {
                // Attach superscript.
                position++;
                superscriptFormula = ReadScript(formula, value, ref position);

                SkipWhiteSpace(value, ref position);
                if (position < value.Length && value[position] == subScriptChar)
                {
                    // Attach subscript also.
                    position++;
                    subscriptFormula = ReadScript(formula, value, ref position);
                }
            }
            else if (ch == subScriptChar)
            {
                // Add subscript.
                position++;
                subscriptFormula = ReadScript(formula, value, ref position);

                SkipWhiteSpace(value, ref position);
                if (position < value.Length && value[position] == superScriptChar)
                {
                    // Attach superscript also.
                    position++;
                    superscriptFormula = ReadScript(formula, value, ref position);
                }
            }

            if (superscriptFormula == null && subscriptFormula == null)
                return atom;

            // Check whether to return Big Operator or Scripts.
            if (atom.GetRightType() == TexAtomType.BigOperator)
                return new BigOperatorAtom(atom, subscriptFormula == null ? null : subscriptFormula.RootAtom,
                    superscriptFormula == null ? null : superscriptFormula.RootAtom);
            else
                return new ScriptsAtom(atom, subscriptFormula == null ? null : subscriptFormula.RootAtom,
                    superscriptFormula == null ? null : superscriptFormula.RootAtom);
        }
Example #18
0
 public DummyAtom(Atom atom)
 {
     this.Type = TexAtomType.None;
     this.Atom = atom;
     this.IsTextSymbol = false;
 }
Example #19
0
 public BigOperatorAtom(Atom baseAtom, Atom lowerLimitAtom, Atom upperLimitAtom, bool? useVerticalLimits = null)
     : this(baseAtom, lowerLimitAtom, upperLimitAtom)
 {
     this.UseVerticalLimits = useVerticalLimits;
 }
Example #20
0
 public void Add(Atom atom)
 {
     if (atom != null)
         this.Elements.Add(atom);
 }
Example #21
0
 public TypedAtom(Atom atom, TexAtomType leftType, TexAtomType rightType)
 {
     this.Atom = atom;
     this.LeftType = leftType;
     this.RightType = rightType;
 }
Example #22
0
 public FractionAtom(Atom numerator, Atom denominator, TexUnit unit, double thickness)
     : this(numerator, denominator, false, unit, thickness)
 {
 }
Example #23
0
 public StyledAtom(Atom atom, Brush backgroundColor, Brush foregroundColor)
 {
     this.RowAtom = new RowAtom(atom);
     this.Background = backgroundColor;
     this.Foreground = foregroundColor;
 }
Example #24
0
 public FractionAtom(Atom numerator, Atom denominator, bool drawLine)
     : this(numerator, denominator, drawLine, TexUnit.Pixel, 0d)
 {
 }
Example #25
0
 private void ChangeAtomToOrdinary(DummyAtom currentAtom, DummyAtom previousAtom, Atom nextAtom)
 {
     var type = currentAtom.GetLeftType();
     if (type == TexAtomType.BinaryOperator && (previousAtom == null ||
         binaryOperatorChangeSet[(int)previousAtom.GetRightType()]))
     {
         currentAtom.Type = TexAtomType.Ordinary;
     }
     else if (nextAtom != null && currentAtom.GetRightType() == TexAtomType.BinaryOperator)
     {
         var nextType = nextAtom.GetLeftType();
         if (nextType == TexAtomType.Relation || nextType == TexAtomType.Closing || nextType == TexAtomType.Punctuation)
             currentAtom.Type = TexAtomType.Ordinary;
     }
 }
Example #26
0
 public OverlinedAtom(Atom baseAtom)
     : base()
 {
     this.Type = TexAtomType.Ordinary;
     this.BaseAtom = baseAtom;
 }
Example #27
0
 internal void Add(Atom atom)
 {
     Debug.Assert(atom != null);
     if (this.RootAtom == null)
     {
         this.RootAtom = atom;
     }
     else
     {
         if (!(this.RootAtom is RowAtom))
             this.RootAtom = new RowAtom(RootAtom);
         ((RowAtom)RootAtom).Add(atom);
     }
 }
Example #28
0
 public UnderlinedAtom(Atom baseAtom)
 {
     this.Type = TexAtomType.Ordinary;
     this.BaseAtom = baseAtom;
 }
Example #29
0
 public void SetForeground(Brush brush)
 {
     if (this.RootAtom is StyledAtom)
     {
         this.RootAtom = ((StyledAtom)this.RootAtom).Clone();
         ((StyledAtom)this.RootAtom).Foreground = brush;
     }
     else
     {
         this.RootAtom = new StyledAtom(this.RootAtom, null, brush);
     }
 }
Example #30
0
 public FractionAtom(Atom numerator, Atom denominator, double relativeThickness,
     TexAlignment numeratorAlignment, TexAlignment denominatorAlignment)
     : this(numerator, denominator, true, numeratorAlignment, denominatorAlignment)
 {
     this.lineRelativeThickness = relativeThickness;
 }