If you'd like to see code for another ebook created in LaTeX, I have the source code for my version of
Introduction to Mathematical Philosophy posted
here. It's a mess by comparison, however, since I use the same .tex file for 6 different PDF outputs. I used a reader.sty file I found here in MobileRead some time back, though it doesn't do anything you can't do easily with the geometry package. Fancyhdr and titlesec can cover the rest.