Role of cation-pi interactions in the photodimerization of trans-4-styrylpyridines.