Here is a smart way to overcome the problem of small spaces in libraries. These moving shelves are in the School of Journalism library at University of Missouri. Such shelves are used especially in the basements.
“In 1908, Walter Williams established the School of Journalism at the University of Missouri, Columbia, the first such school in the world.” [source]
p.s. The shelves stop automatically if someone moves between the shelves or were obstructed by an object.