modified script to combine latex tables