The book title plus the year of publication (1895) should hint at it a bit.
There is a deeper inspiration as well I believe. It seemed to me like the play-within-a-play that drives you mad is exactly what we see happening to the main characters in TD1.