improving legendre.tex