LaTeX techniques and templates for writing a book
For a general introduction to book design using LaTeX, do check out A Few Notes on Book Design by Peter Wilson. Obviously, there is no single "correct" answer as to how a book ought to be designed. If you have considerable freedom in selecting a design, as seems to be implied by your question, you could start by simply taking a close look at the layouts of some books -- whether or not they are in the same field as the book you intend to publish -- and decide whivh parts of the overall design of these books you like (or dislike).
Among the criteria should be
- size and proportions of page -- and of text block within a page?
- are there (wide) margins containing supplemental notes, callouts, etc.?
- use of running headers?
- layout of sectioning headers (chapters, sections, subsections, etc)
- font and font sizes?
- use of color (including "bold", i.e., more black than normal text font)?
- use of boxes and other visually-appealing techniques?
- quality of paper (shiny or matte; smooth or rough to touch)?
- if the book will be available in electronic format: any hyper-linking of materials?
And so on... Have fun!
Since you mentioned R, I would recommend you to use the knitr
package instead of Sweave. You can go to the package website to know more about it: http://yihui.name/knitr It is much more flexible and customizable than Sweave. For example, you only need to call render_listings()
in order to switch to the listings
package (e.g. http://yihui.name/knitr/demo/listings/). Recently I also started thinking on writing a book: https://github.com/yihui/knitr-book The basic sketch is there, and I'm writing with markdown instead of LaTeX since the former is much easier to write; I can convert markdown files to LaTeX later with I have finished the knitr book using pandoc
if I want.knitr
and LyX.
I apologize in advance for this being not much of an answer--but as N.N. mentioned in his comment, you'll get much better responses if you ask each of your questions separately.
and 4. I'm also a beginner at LaTeX, but I've been using the
memoir
class to write a book, and it's been incredibly helpful. It has built-in support for chapter headings, page headers and footers, indices, etc.You might find this article helpful.