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); }
public FractionAtom(Atom numerator, Atom denominator, bool drawLine, TexAlignment numeratorAlignment, TexAlignment denominatorAlignment) : this(numerator, denominator, drawLine) { this.numeratorAlignment = CheckAlignment(numeratorAlignment); this.denominatorAlignment = CheckAlignment(denominatorAlignment); }
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; } }
public ScriptsAtom(Atom baseAtom, Atom subscriptAtom, Atom superscriptAtom) : base() { this.BaseAtom = baseAtom; this.SubscriptAtom = subscriptAtom; this.SuperscriptAtom = superscriptAtom; }
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; }
public BigOperatorAtom(Atom baseAtom, Atom lowerLimitAtom, Atom upperLimitAtom) { this.Type = TexAtomType.BigOperator; this.BaseAtom = baseAtom; this.LowerLimitAtom = lowerLimitAtom; this.UpperLimitAtom = upperLimitAtom; this.UseVerticalLimits = null; }
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"); }
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"); }
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); } }
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; }
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); } } }
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; }
public PhantomAtom(Atom baseAtom) : this(baseAtom, true, true, true) { }
public void Add(Atom atom) { this.Formula.Add(atom); }
public VerticalCenteredAtom(Atom atom) { this.Atom = atom; }
public Radical(Atom baseAtom, Atom degreeAtom = null) : base() { this.BaseAtom = baseAtom; this.DegreeAtom = degreeAtom; }
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); }
public DummyAtom(Atom atom) { this.Type = TexAtomType.None; this.Atom = atom; this.IsTextSymbol = false; }
public BigOperatorAtom(Atom baseAtom, Atom lowerLimitAtom, Atom upperLimitAtom, bool? useVerticalLimits = null) : this(baseAtom, lowerLimitAtom, upperLimitAtom) { this.UseVerticalLimits = useVerticalLimits; }
public void Add(Atom atom) { if (atom != null) this.Elements.Add(atom); }
public TypedAtom(Atom atom, TexAtomType leftType, TexAtomType rightType) { this.Atom = atom; this.LeftType = leftType; this.RightType = rightType; }
public FractionAtom(Atom numerator, Atom denominator, TexUnit unit, double thickness) : this(numerator, denominator, false, unit, thickness) { }
public StyledAtom(Atom atom, Brush backgroundColor, Brush foregroundColor) { this.RowAtom = new RowAtom(atom); this.Background = backgroundColor; this.Foreground = foregroundColor; }
public FractionAtom(Atom numerator, Atom denominator, bool drawLine) : this(numerator, denominator, drawLine, TexUnit.Pixel, 0d) { }
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; } }
public OverlinedAtom(Atom baseAtom) : base() { this.Type = TexAtomType.Ordinary; this.BaseAtom = baseAtom; }
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); } }
public UnderlinedAtom(Atom baseAtom) { this.Type = TexAtomType.Ordinary; this.BaseAtom = baseAtom; }
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); } }
public FractionAtom(Atom numerator, Atom denominator, double relativeThickness, TexAlignment numeratorAlignment, TexAlignment denominatorAlignment) : this(numerator, denominator, true, numeratorAlignment, denominatorAlignment) { this.lineRelativeThickness = relativeThickness; }