/* -*- gp-script -*- */ \\% TeX printing of polynomials \\ Author: Joerg Arndt \\ License: GPL version 3 or later \\ online at http://www.jjj.de/pari/ \\ version: 2014-October-16 (18:30) polprinttex(p, v="x")= { my(t, q, s); print1("{"); q=0; for(j=0, poldegree(p), t=polcoeff(p, j); if ( 0==t, print1(""), /* coeff==zero */ s = sign(t); if ( (s>0) && (0!=q), print1(" +"), print1(" ") ); if ( +1==t, print1(" ") ); /* omit coeff==one */ if ( -1==t, print1("-"), print1(t) ); /* coeff==-one ? */ if ( 0!=j, /* nonzero exponent */ print1("\\,", v); if (j>1, print1("^{", j, "}"); ); ); q = 1; ); ); print1("}"); } /* ----- */ \\ ==== end of file ====