τ-function evaluation of gap probabilities in orthogonal and symplectic matrix ensembles