示例#1
0
        public string MakeDivTexString(
            Polynom <T, R> aDenumerator, Polynom <T, R> aQuot, List <Polynom <T, R> > aRemainder, string aVarName)
        {
            var _sb = new StringBuilder();

            _sb.AppendLine(@"\extrarowheight=2pt");
            _sb.AppendLine(@"\arraycolsep=0.05em");
            _sb.AppendFormat(@"\begin{{array}}{{");
            for (int i = 0; i <= this.Degree; ++i)
            {
                _sb.Append("r");
            }
            _sb.Append(@"@{\,}r|l}");
            _sb.AppendLine();
            _sb.Append(this.TexString(aVarName, true));
            _sb.Append(@"&&\,");
            _sb.Append(aDenumerator.TexString(aVarName, false));
            _sb.Append(@"\\");
            _sb.AppendLine();
            _sb.AppendFormat("\\cline{{{0}-{0}}}", this.Degree + 3);

            var _secondString = String.Format("{0}&&\\,{1}\\\\",
                                              aRemainder[0].TexString(aVarName, true).TrimEnd('\\'), aQuot.TexString(aVarName, false));

            _sb.AppendLine(_secondString);

            for (var i = 1; i < aRemainder.Count; ++i)
            {
                if (i % 2 == 1)
                {
                    int s = this.Degree - aRemainder[i - 1].Degree + 1;
                    _sb.AppendLine(String.Format("\\cline{{{0}-{1}}}", s, s + aDenumerator.Degree));
                }

                int _shift = this.Degree - aRemainder[i].Degree + 1;
                if (aRemainder[i].Degree < 0)
                {
                    _shift--;
                }

                var _pref = new String('&', _shift - 1);
                _sb.AppendLine(String.Format("{0}{1}\\\\", _pref, aRemainder[i].TexString(aVarName, true)));
            }

            _sb.AppendLine(@"\end{array}");

            return(_sb.ToString());
        }
示例#2
0
 public override string GetTexString(Polynom <T, R> a)
 {
     return(String.Format("[{0}]", a.TexString()));
 }