+ if (precedence() <= level)
+ c.s << "(";
+
+ std::string par_open = is_a<print_latex>(c) ? "{(" : "(";
+ std::string par_close = is_a<print_latex>(c) ? ")}" : ")";
+
+ // objects of type pseries must not have any zero entries, so the
+ // trivial (zero) pseries needs a special treatment here:
+ if (seq.empty())
+ c.s << '0';
+ epvector::const_iterator i = seq.begin(), end = seq.end();
+ while (i != end) {
+ // print a sign, if needed
+ if (i != seq.begin())
+ c.s << '+';
+ if (!is_order_function(i->rest)) {
+ // print 'rest', i.e. the expansion coefficient
+ if (i->rest.info(info_flags::numeric) &&
+ i->rest.info(info_flags::positive)) {
+ i->rest.print(c);
+ } else {
+ c.s << par_open;
+ i->rest.print(c);
+ c.s << par_close;
+ }
+ // print 'coeff', something like (x-1)^42
+ if (!i->coeff.is_zero()) {
+ if (is_a<print_latex>(c))
+ c.s << ' ';
+ else
+ c.s << '*';
+ if (!point.is_zero()) {
+ c.s << par_open;
+ (var-point).print(c);
+ c.s << par_close;
+ } else
+ var.print(c);
+ if (i->coeff.compare(_ex1())) {
+ c.s << '^';
+ if (i->coeff.info(info_flags::negative)) {
+ c.s << par_open;
+ i->coeff.print(c);
+ c.s << par_close;
+ } else {
+ if (is_a<print_latex>(c)) {
+ c.s << '{';
+ i->coeff.print(c);
+ c.s << '}';
+ } else
+ i->coeff.print(c);
+ }
+ }
+ }
+ } else
+ Order(power(var-point,i->coeff)).print(c);
+ ++i;
+ }