There is a type of plate rack often used at serving counters which consists of a vertical tube with a sprung platform in it. The spring free length is such that the platform is exactly level with the top of the tube when it is unloaded, and the spring rate is chosen so that the weight of a plate compresses it by exactly the height of a plate. This means that no matter how many plates it's holding, the top plate is just at the top of the tube.
You could do something similar for your book stand. As well as showing the curious some interesting physics, it means that you could sense the number of books from the bottom of the pile rather than the top, which you could do using a string/pot or whatever other type of distance sensor you like. Of course you could have read from the bottom of the stack anyway using a force sensitive resistor to measure the weight of the pile, and that would be my second choice, but that's far less fun.