An alternative method is presented for extracting the von Neumann entropy $-operatorname{Tr} (rho ln rho)$ from $operatorname{Tr} (rho^n)$ for integer $n$ in a quantum system with density matrix $rho$. Instead of relying on direct analytic continuation in $n$, the method uses a generating function $-operatorname{Tr} { rho ln [(1-z rho) / (1-z)] }$ of an auxiliary complex variable $z$. The generating function has a Taylor series that is absolutely convergent within $|z|<1$, and may be analytically continued in $z$ to $z = -infty$ where it gives the von Neumann entropy. As an example, we use the method to calculate analytically the CFT entanglement entropy of two intervals in the small cross ratio limit, reproducing a result that Calabrese et al. obtained by direct analytic continuation in $n$. Further examples are provided by numerical calculations of the entanglement entropy of two intervals for general cross ratios, and of one interval at finite temperature and finite interval length.