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.


closed as too broad by user13907, Zarko, egreg, Jesse, Svend Tveskæg Apr 3 '16 at 11:38

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Welcome to TeX - LaTeX! This is a very broad question and it sounds like you have some misconceptions about how to use LaTeX. I would suggest looking at tex.stackexchange.com/q/4420/15925 first to get links to starting material. Your LaTeX code needs to be written in some external editor. A program latex or pdflatex (or ...) is then used to compile/typeset the code into a printable document. Packages are collections of helper macros to include in your LaTeX code. – Andrew Swann Apr 3 '16 at 8:32
  • 2
    Personally, i recomend LaTeX for complete novices. Having read that (or any other up-to-date introduction) will clear the first very broad questions and you will be able to ask spot oon questions on one topic. The question right now is really really broad. – Johannes_B Apr 3 '16 at 8:50
  • 1
    Write directly in your LaTeX-editor. Start with a good book class, like tufte-latex. Focus on writing, and make the clean-up when you have finish the first draft of the whole book. One or several files, depend on the length and complexity. – Sveinung Apr 3 '16 at 9:09
  • Since your book can change a lot, my suggestion is maybe unusual, but I'd say to write elsewhere, focus on the content. Latex is pure formatting and how you present your content. You can write your book elsewhere and not bother with the formatting. If you need some particular formatting (e.g. a poem in your novel), you can maybe test that to see if it works well with your work, but maybe using Latex from the start might distract you. – Alenanno Apr 3 '16 at 9:46

First of all, remind yourself every morning the KISS principle (Keep it simple, stupid). With this principle in mind:

  1. 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?

  2. Do not start with a elaborate LaTeX templates, but with a very simple document for a book. A minimal working example (MWE):

\title{Computer programing}
Some text ...
  1. 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 use listing, minted, etc. if you do not want the simple verbatim environment for this. See What packages do people load by default in LaTeX? for some more essential packages in many documents.

  2. Use a single file for small projects and subdocuments for huge projects. You can use \include{Introduction} to include a Introduction.tex chapter or \input{Something} if Something.tex is a smaller subdocument. See When should I use \input vs. \include?.

  3. Beside obtain some basic tutorial, try to find yourself solutions to common questions of this site and learn from the MWE of others.

  • 2
    +1 for answering a question, which others dismissively considered as „too broad“ – Christof Kälin Feb 18 at 9:05

LaTeX is made for people like you: you have computer skills and the understanding, that concepts matter.

Go and get a beginners guide to LaTeX. Other than some commentator said, one of the concepts of LaTeX is to separate between content and typesetting. Don't use a "template", start from scratch. Use a komascript documentclass, e.g. scrbook.

For code you need a package, e.g. listings, for screenshots graphicx. texdoc packagename will usually provide the manual.

Have fun!

Not the answer you're looking for? Browse other questions tagged or ask your own question.