91

I have taken a look at other questions, and I don't see any answer to my question. If this is a duplicate for some question I haven't seen, feel free to comment.

I am an experienced TeX user, I've been writing with TeX for about 3-4 years now. I am pretty good with TikZ too. The problem is, all that I have learned comes from one of my teachers that gave me packages so that I don't have much to worry about, and I never got in the technical stuff on my own (or at least never understood a thing of it).

I want to write a book, so I need to be able to deal with stuff like margins, labels, pagination, separating my TeX files into many files so that I don't have to compile the whole book each time I wanna remove/add a comma, etc. I am looking—not for a user manual that states what all commands do like a dictionary, because I know there are plenty out there and I have some—but rather like an introduction to using a book class, with examples and such. If you know what I'm talking about, the PGF-TikZ pdf is a great example of a such PDF ; it describes commands, yes, but there are plenty of examples and little commands are usually detailed while constructing a bigger example.

12
  • 16
    perhaps the memoir class documentation (texdoc memman) is what you're looking for
    – henrique
    Mar 14, 2012 at 4:40
  • 4
    This is really a lot of questions bundled together. You should try breaking it down into smaller, more well defined questions.
    – qubyte
    Mar 14, 2012 at 4:44
  • 1
    Your question doesn't give us enough information. For example, what kind of book? A manual? A novel? A text book? You should try things first, and ask questions here when you come across a problem that you can't solve. This is far too broad at the moment.
    – qubyte
    Mar 14, 2012 at 4:47
  • 1
    In which case the question is once again: What kind of book are you writing? Document classes for books usually built with a particular type of book in mind. i.e. a text book may look beautiful in tufte-book, but perhaps better in amsbook if it's heavy on mathematics.
    – qubyte
    Mar 14, 2012 at 5:00
  • 3
    When I say picture I mean any graphic. The environment for TikZ is called tikzpicture after all. In Tufte you can put these images to the side of the text, so they don't break the flow. In amsbook there is the potential for breaking flow and consuming a lot of extra space. Take a look at the examples for these classes.
    – qubyte
    Mar 14, 2012 at 5:16

6 Answers 6

89

Well, from my own experience I would suggest that you first focus on the content, then again on the content and after that, on the content. At the very end, you might play around with different styles and packages to modify the appearance of your text. With a long term project like a book it is very important to get not too much distracted by unimportant things.

In the end, there might be a publisher who insists on a particular style/class anyway. Many publishers in science have their own classes which one is obliged to use. But unless you have a complete manuscript, it is very unlikely that a publisher will agree on publishing your text. So first: just write the stuff with some standard class (the ordinary book class...) and finish the text.

EDIT: OK, maybe this was not too helpful, so here is some more addition:

  1. In a first step you should ask yourself what kind of audience you would like to address. This will determine the way you write very much. In math you want a textbook with exercises and detailed proofs or more a monograph with extended bibliography, etc.

  2. Structure and order your thoughts. Make a table of contents with preliminary summaries of all the sections/subsections. I used to do this in a separate tex-file "plan.tex" or so, which was also subject to change (quite a lot) during the writing.

  3. Be consistent with notation. Before you write, you should fix some notational issues: in particular in math, it is very important that you use the same symbols throughout, use symbols familiar to others, etc.

  4. Making a main.tex with inputs/includes of the chapters which input the sections etc. Here the style/class is not yet essential, it should just support a command like "\chapter". Note that input is a quicker, yet simpler and even limited, command. mwe:

    \documentclass[a4paper,10pt]{book}
    \input{packages} %\usepackage[utf8]{inputenc}
    \begin{document}
    \include{chapter1}
    \include{chapter2}
    \input{etc}
    \end{document}
    
  5. Fill your files with content. This will take 99% of your time.

  6. Check with some publisher etc where you want to place your work. They will provide a style-file or tell you which one of the standard ones is traditionally used with them. If they want to publish it at all.

  7. Then, and this takes not much work at all compared to the rest, adapt your sources to the class/style needed, fix the hboxes, massage the bibliography, scale the pictures appropriately etc.

So I hope that this is a reasonable workflow. It will be point 5 which really requires the most attention and work, the rest is cosmetics.

7
  • 10
    Great answer (+1)! To help on focusing on content, one might want to use markdown/pandoc/etc., and then at the very end, convert it to another format where one can concentrate only on style as you have structurally and semantically solid document representation.
    – morbusg
    Mar 14, 2012 at 8:31
  • Hi @Stefan How is step 4 done?
    – Peter Flom
    Aug 5, 2013 at 17:58
  • Generally a good advice... but according to my experience, the designer doesn't use latex at all, and my knowledge of latex is too weak for even such simple task as expanding margin for 1pt. Despite the fact I wrote thousands of formulas and draw hundreds of tikz pictures up to this point. Writing in MS Word would lead to the exactly same result. :-(
    – Pygmalion
    Sep 25, 2013 at 18:20
  • @Pygmalion Well, this depends probably very much on the field. My experience in math was that the publishers do provide some style files which in the end you should use. But changing things from standard book.cls to the more specific ones was only a minor part of the work at the very end (taking some 2 days compared with 3 years of writing the rest). In the end, the publisher just wanted the final pdf from me which was directly printed (without any editorial works) Oct 2, 2013 at 7:03
  • 9
    +1 Fill your files with content. This will take 99% of your time.
    – nilon
    Sep 14, 2016 at 12:48
44

If you're already familiar with (LaTeX), then I would heartily recommend just starting to write (as Yiannis says), but with the memoir class (which you can read up on in parallel as the work evolves), rather than book.

Memoir includes two really good manuals: The Memoir Class for Configurable Typesetting is a combination of good typography and how-to-do-it, and A Few Notes on Book Design which goes into a bit of history and underlying principles.

I've been a memoir user for around seven years now. There was an initial learning curve (but only because I was already demanding more tweaks than might be proper!), but it has repaid the investment many times over, and, today, apart from books, the only thing I don't use memoir for is presentations.

The only other recommendations I would make are these: as it's a "new project", go with LuaLaTeX, BibLaTeX, fontspec for font tweaking, and 100% unicode.

2
  • Does memoir handle Arabic text ?
    – Ibn Saeed
    Jun 20, 2014 at 9:37
  • 2
    My first guess would be yes, but you're going to need additional packages, probably starting with polyglossia. I imagine you'll need Unicode support, so XeLaTeX or LuaLaTeX is also a must. It might be worth posting this as a proper question; I know memoir fairly well, but only in the context of left-to-right scripts. Jun 20, 2014 at 19:44
26

Separation of presentation and content

LaTeX is based on the idea that authors should be able to focus on the content of what they are writing without being distracted by its visual presentation. In preparing a LaTeX document, the author specifies the logical structure using familiar concepts such as chapter, section, table, figure, etc., and lets the LaTeX system worry about the presentation of these structures. It therefore encourages the separation of layout from content while still allowing manual typesetting adjustments where needed.

(from wikipedia)

I agree with a lot of things described by other contributors but I think if you want to avoid a waste of time, you need to prepare the separation of presentation and content.

All the good classes give sectioning tools. So you can start working with chapter, section etc. but if you want write a math book, you need theorem, definition, remark , examples, etc.

Some classes give you these tools but it's easy to create them. In a first time, these environments can do nothing : for example

 \newenvironment{theo}{My theorem :}{\par} 

 \begin{theo}
      All I have to do it's to use fake environment
  \end{theo} 

Then you need to create some macros (fake or empty macros) \newword \GreatPerson \ImportantWord or FirstDef you can define these macros like this:

\newcommand{\ImportantWord}[1]{#1}
 \newcommand{\GreatPerson}[1]{#1} 

 \ImportantWord{Geometry}
 \GreatPerson{Pythagore}

I forgot two important macros : \number and \unit. It's not important to choice directly "sinunitx" or "numprint" but you need to prepare the formatting of the numbers and unities. If you don't do that immediately, it's a waste of time to format the numbers at the end.

And you need to prepare the index and the bibliography. I think is very useful to prepare the index. In a first time you can use \index{thisword} but it can be useful to have some specific macros. You can look at the file Mathmode.ltx of Herbert Voss to get some ideas. You can find something like

  \def\tIndex#1{\index{#1@{\UrlFont\texttt{#1}}}}
  \def\cIndex#1{\index{#1@\CMD{#1}}} 

But in a first time, fake macros are fine !

Now you can start writing "immediately", using the standard book class and not worrying too much about presentation.

With environments and macros you are ready to finish the presentation like you want. Without these environments and macros, it's difficult to find something in your text.

4
  • 9
    When you're done entering the content, and you decide you want to change the appearance of some stuff, and there are thousands of those stuff, you'll be very, very, happy you used all those fake macros...
    – gablin
    Mar 14, 2012 at 22:29
  • Yes ! After the first book, you know what you need. Before writing the first book, it would be a good idea to read some other works and I think after the first chapter, there is still time to change some details. Mar 15, 2012 at 5:26
  • Love the answer, because it is also helpful for people who only know some LaTeX. May 7, 2017 at 9:56
  • I "think" I like this answer. I +1 it. But, well, I guess it is just a path to more advanced stuff. You just made me curious and with no guidances or pointers to where to go to finish all those fake macros and alike. Anyway, a good "food for thought"
    – DrBeco
    Sep 22, 2018 at 3:18
20

In terms of completeness and detail the best information is still in books rather than publications on the web. Personally I think The LaTeX Companion Second Edition  by Frank Mittelbach et al  is still the best place to start, especially for a new book project, although newer books are available.

My recommendation though since you already know a bit about LaTeX is to just start writing immediately, using the standard book class and not worrying too much about presentation. When you are in about Chapter 5, you can start experimenting with different classes or even writing your own. The book class virtually guarantees compatibility with any other class.

1
  • 2
    I think yours it's a good advice, so I will follow it!
    – karloswitt
    Mar 26, 2022 at 14:02
17

In oppostion to other answers here I really recommend to spent a few days to prepare a framework in LaTeX.

Think twice about your workflow and the technical tools you need.

For example, how will you leave comments and annotations for yourself? How do you delete them? I usually write them into the margin in small red print and use the marginfix package. To this end I define a new command, simply something like \Anm (German abbrev. for comment).

Will you need a comparison between versions? Or even different versions? Take a day to become familiar with a version system. I'm using git and to build comparisons between versions the script latexdiff-git. A version system may help a lot in case you get stuck and you need to return to a earlier version.

I prefer scrbook to memoir, because KOMA-script adopts the european way to typeset, and for many more reasons.

To speed up compilation have a look at latexmk.

And the most important thing: Employ \label and \ref as much as possible for any reference. Learn how to use Zotero or whatever way to manage your bibliography! Probably you should prefer BibLaTeX to BibTeX.

Which encoding? utf-8 probably, but however, do not mix encondings, choose one which is sufficient for all kind of texts in your book.

Don't use LuaTeX or XeTeX for a serious project. LuaTeX simply is buggy and slow. pdfTeX still is the engine, for many years. There hasn't been a new LuaTeX version for a year!

How do you handle updates / upgrades of texlive or MikTeX? The former maintainer of the Libertine package one day published an incompatible update and after receiving some unfriendly comments withdrew from maintaining the package, leaving me behind with broken files. So it would be advisable to have way to test your monthly update before you encounter a lot of stress.

How will you backup your work consistently, inhouse and somewhere else?

I could go on writing, but I think you got the message: Think intensly on each step of your workflow at the beginning.


Edit due to comments below:

As user pmav99 argues, if you use non latin fonts, XeTeX is very helpfull. I agree with that; I was too narrow minded on the disadvantages of XeTeX. There surely are advantages which may justify using XeTeX »in a serious project«.


Edit three years later:

LuaTeX became a bit faster, but on a windows machine is much slower than pdftex, still. BibLaTeX and Biber are state of the art. And for the rest of my answer: no change.

7
  • Dear Keks Dose: I agree that one should also organize the actually TeXing in a reasonable way. I had the impression that the OP has some ideas about that. Nevertheless, I made the experience that using too fancy style/classes will result in more trouble when sending the things to a publisher than having just a plain and easy layout. And for a book this should be the ultimate goal. In any case: using git or so is really really useful! Mar 16, 2012 at 10:45
  • 2
    I would suggest the package todonotes. This helps a lot for annotations and comments.
    – qbi
    Mar 19, 2012 at 10:22
  • 1
    Could you elaborate a bit on advising against xe(la)tex? Apart from being close to necessary in many cases, I ve never experienced any problem to speak off.
    – pmav99
    Mar 20, 2012 at 19:35
  • 1
    @pmav99 Packages will remain compatible to pdfTeX, I believe, for many more years. But since LuaTeX will be (hopefully) developed and package maintainers have to adapt their packages, regarding XeTeX it is less likely, that a package you picked in 2012 will be compatible in 2016.
    – Keks Dose
    Mar 21, 2012 at 8:33
  • Perhaps, but since for the most part, packages for pdflatex are also compatible with xelatex I don't think that this is going to become a show-stopper. Anyway at the moment, xelatex is almost obligatory if you do not use the latin alphabet, and even in the english speaking world, the ability to easily use any font you want is a great feature. Time will show if your predictions are correct, but I feel that you are exaggerating when you claim that it shouldn't be used in serious projects. It can be used and it is used.
    – pmav99
    Mar 22, 2012 at 21:07
0

Unfortunately, the question is too broad. It really should be flagged, but since it has been around for a long time, I suppose it is a good question.

Previous answers (focus on content) are important. In fact, unless your book specifically contains material requiring TeX math capability and diagrams, I recommend that you write it in a word processor, using a font that enables you to see small errors. You can format in TeX later.

I suggest that you disregard previous advice about avoiding LuaLaTeX. It is only "slow" in terms of adding a little time to compiling. But it is "fast" in terms of allowing you to use UTF-8 encoding and Open Type fonts, without worrying about last-century TeX encodings.

Not many TeX users write ordinary fiction. But if you do, consider using the "novel" document class (new in 2017). It is specifically written for print-on-demand fiction requirements, and comes with elaborate documentation. In fact, it is pre-configured to produce the most commonly used book size (at least in the USA) for fiction. You have to install "novel" from package manager, as it is not built into the TeX distribution.

3
  • I highly disagree with your idea of writing in a word processor. You are not going to learn how to use something by not using it! I did follow the advice given here and my focus has been mainly on content for a long time. Every now and then, there was a particularly annoying part of my TeX that I did want to improve and I took the time to fix it. All those little improvements made me a better editor over time. If I had not used TeX from day 1, I would have lost all that experience. Oct 26, 2017 at 17:36
  • Disagreeing with your disagreement! I have actually written a book that way, written in a word processor (content only) and finished in TeX (markup only). And, I am the author of the "novel" document class, not a newbie. Advantage to word processor: Probably contains more powerful spelling check, maybe grammar check, and easily allows you to change the visible font when you need to edit. Plus, you can send the file to a third party for editing. Books needs editors.
    – user139954
    Oct 26, 2017 at 18:24
  • 1
    I guess we disagree because we are doing different things : I write mostly math books, where the TeX content is a bit more involved than in plain text. But I am the one who asked the question! So I win! Haha Oct 26, 2017 at 18:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .