This is my first time using LaTeX.
It's also my first time writing a book.
But I find myself with a little time on my hands and I thought I'd write a simple(ish) book for my 11yo son to learn computer programming. The book will contain lots of code examples and screen shots.
So my question is: what strategy should I use to write this book, assuming that I'll use LaTeX (on a Mac. I installed MacTeX) to do the typesetting?
One web site I read said to do the writing in a word processor first, then copy it all into LaTeX to do the typesetting. Other similar questions on this site seem to suggest just writing in whatever LaTeX package they are using. I don't want to get too far down one path only to find that I have to change my system of working and change everything, so any suggestions here are welcome.
Sorry if all this is newbie questions, but well, I am a newbie.
Cheers.
Best Answer
First of all, remind yourself every morning the KISS principle (Keep it simple, stupid). With this principle in mind:
To write plain text without format you do not need a big word processor. Any good text editor could do that. Any LaTeX editor could do that. When you are writing, the nice of LaTeX in that you can focus most time in the structure and contents of the documents, not in the format, while in word processors you are always checking the format. People in TeX.SX love the first approach and the rest of the mortals the second. Both are legitimate, but does not make sense to use the second for the first. For instance, why the hell you should see the pagination in the word processor, when the result in LaTeX will be different?
Do not start with a elaborate LaTeX templates, but with a very simple document for a book. A minimal working example (MWE):
Add only to the preamble what you really understand and what you really need. For instance, for the screen shots you will need the
graphicx
package. So, in the preamble (before of\begin{document}
) you should add\usepackage{graphicx}
. For compute code listing you can uselisting
,minted
, etc. if you do not want the simpleverbatim
environment for this. See What packages do people load by default in LaTeX? for some more essential packages in many documents.Use a single file for small projects and subdocuments for huge projects. You can use
\include{Introduction}
to include aIntroduction.tex
chapter or\input{Something}
ifSomething.tex
is a smaller subdocument. See When should I use \input vs. \include?.Beside obtain some basic tutorial, try to find yourself solutions to common questions of this site and learn from the MWE of others.