Example #1
0
        private Box LongDivision__colon__right__equals__right(TexEnvironment environment)
        {
            var divisor_dividend_quotient = new HorizontalBox();

            var dividendbox = this.DividendAtom == null ? StrutBox.Empty : this.DividendAtom.CreateBox(environment);
            var leftsep     = SymbolAtom.GetAtom("colon", this.Source).CreateBox(environment);
            var divisorbox  = this.DivisorAtom == null ? StrutBox.Empty : this.DivisorAtom.CreateBox(environment);
            var rightsep    = SymbolAtom.GetAtom("equals", this.Source).CreateBox(environment);
            var quotientbox = this.QuotientAtom == null ? StrutBox.Empty : this.QuotientAtom.CreateBox(environment);

            divisor_dividend_quotient.Add(dividendbox);
            divisor_dividend_quotient.Add(leftsep);
            divisor_dividend_quotient.Add(divisorbox);
            divisor_dividend_quotient.Add(rightsep);
            divisor_dividend_quotient.Add(quotientbox);

            var otherbox = this.OtherAtom == null ? StrutBox.Empty : this.OtherAtom.CreateBox(environment);


            var resultBox = new VerticalBox();

            resultBox.Add(divisor_dividend_quotient);
            resultBox.Add(otherbox);

            return(resultBox);
        }
Example #2
0
        public AccentedAtom(SourceSpan source, Atom baseAtom, string accentName)
            : base(source)
        {
            this.BaseAtom   = baseAtom;
            this.AccentAtom = SymbolAtom.GetAtom(accentName, null);

            if (this.AccentAtom.Type != TexAtomType.Accent)
            {
                throw new ArgumentException("The specified symbol name is not an accent.", "accent");
            }
        }
Example #3
0
        private Box LongDivisionStyle_lefttop(TexEnvironment environment)
        {
            var texFont = environment.MathFont;
            var style   = environment.Style;
            var axis    = texFont.GetAxisHeight(style);
            var defaultLineThickness = texFont.GetDefaultLineThickness(style);

            var    dividend_divisor = new HorizontalBox();
            var    divisorbox       = this.DivisorAtom == null ? StrutBox.Empty : this.DivisorAtom.CreateBox(environment);
            var    leftsep          = SymbolAtom.GetAtom("rbrack", this.Source).CreateBox(environment);
            var    dividendbox      = this.DividendAtom == null ? StrutBox.Empty : this.DividendAtom.CreateBox(environment);
            double barwidth         = leftsep.TotalWidth + dividendbox.TotalWidth;
            var    separatorbar     = new HorizontalRule(environment, defaultLineThickness, barwidth, -dividendbox.TotalHeight - defaultLineThickness);


            dividend_divisor.Add(divisorbox);
            dividend_divisor.Add(leftsep);
            dividend_divisor.Add(dividendbox);
            dividend_divisor.Add(new StrutBox(-barwidth, dividendbox.TotalHeight, 0, 0));
            dividend_divisor.Add(separatorbar);

            var quotient_pad      = new HorizontalBox();
            var quotientbox       = this.QuotientAtom == null ? StrutBox.Empty : this.QuotientAtom.CreateBox(environment);
            var leftspace         = dividend_divisor.TotalWidth - quotientbox.TotalWidth;
            var quot_leftspacebox = new StrutBox(leftspace, quotientbox.TotalHeight, 0, 0);

            quotient_pad.Add(quot_leftspacebox);
            quotient_pad.Add(quotientbox);

            var otherbox = this.OtherAtom == null ? StrutBox.Empty : this.OtherAtom.CreateBox(environment);


            var resultBox = new VerticalBox();

            resultBox.Add(quotient_pad);
            resultBox.Add(dividend_divisor);
            resultBox.Add(otherbox);

            return(resultBox);
        }