# Document class for designing a book

Introduction

I've been using LaTeX for 15 years, but one year ago I started to write for the first time in my life a real book for students. So I followed usual widespread conviction: concentrate on the contents, the LaTeX will take care of the rest. However, this conviction holds only if you are writing a thesis or an article, where styling is largely unimportant (who reads theses anyway?).

Namely, after finishing my writing after one year of work I was into a real unpleasant surprise. I've received a modest lump of money to find a designer for a book. There is a big pool of good book designers out there, but not one has ever wrote a command in LaTeX. Which in fact means one year of intensive work shall be retyped in some other LaTeX incompatible program, figures shall be rescaled together with fonts... and everything I was so damn careful for over a year will be messed up in a second...

Question

Is it possible for a non-professional semi-experienced LaTeX user to implement design ideas to the document himself and save his precious work? Which document class should s/he start with?

To demonstrate poor performance of standard LaTeX classes for book design, I will show you part of the code written using KOMA-Script scrbook and approximate proposition from the designer.

Minimum working example:

\documentclass[12pt,parskip]{scrbook}
\usepackage[cp1250]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath}

\input{slike_1} % TikZ pictures

\begin{document}

\textit{Enakomerno večdimenzionalno gibanje} označuje gibanje, pri katerem je vektor hitrosti konstanten.  Gibanje tem primeru opisuje enačba, ki je posplošitev enačbe~(...)
%
$$\vec{r} = \vec{v} t + \vec{r}_0,\label{k-umm}$$
%
kjer $\vec{r}$ označuje trenutni, $\vec{r}_0$ pa začetni položaj telesa.  Vektorju $\text{r}$, ki označuje položaj telesa, pravimo tudi \textit{krajevni vektor}.

\textit{Enakomerno pospešeno večdimenzionalno gibanje} označuje gibanje, pri katerem je vektor pospeška~$\vec{a}$ konstanten.  Gibanje v tem primeru opisujejo enačbe, ki so posplošitve enačb~(...)
%
\begin{align}
\vec{r} &= \tfrac{1}{2} \vec{a} t^2 + \vec{v}_0 t + \vec{r}_0\label{k-uamm1}\\
\vec{v} &= \vec{a} t + \vec{v}_0 \label{k-uamm2}\\
v^2 &= v_0^2 + 2 \vec{a} \cdot (\vec{r} - \vec{r}_0) \label{k-uamm3}
\end{align}
%
kjer so $\vec{r}$ trenutni in $\vec{r}_0$ začetni krajevni vektor telesa, ter $\vec{v}$ trenutni in $\vec{v}_0$ začetni vektor hitrosti telesa.  Pri tem je tretja enačba izpeljana iz prvih dveh.

\begin{figure}[!ht]
\centering
\Tpro
\caption{Poševni met}
\end{figure}

Če se telo nahaja v bližini Zemeljske površine, nanj deluje konstantni pospešek prostega pada $g = 10$~m/s$^2$ navpično navzdol.  Vsako tako gibanje telesa je dejansko \textit{dvo}-dimenzionalno, saj se telo giblje po navpični ravnini.  Po dogovoru $y$~os usmerimo navpično navzgor, torej nasproti smeri pospeška prostega pada ($\vec{a} = - g \vec{j}$), $x$~os pa tako, da začetna hitrost leži v $xy$ ravnini $\vec{v}_0 = v_{x0} \vec{i} + v_{y0} \vec{j}$.  Potem lahko vsako od enačb~(...) razstavimo na \textit{dve} skalarni enačbi in dobimo
%
\begin{align}
x(t) &= v_{x0} t + x_0, \label{k-prsx}\\
y(t) &= -\tfrac{1}{2} g t^2 + v_{y0} t + y_0, \label{k-prsy}\\
v_x(t) &= v_{x0}, \label{k-prvx}\\
v_y(t) &= -g t + v_{y0}. \label{k-prvy}
\end{align}

Pri tem smo upoštevali, da je pospešek v $x$~smeri enak $a_x = 0$, pospešek v $y$~smeri pa $a_y = -g$, kar pomeni, da imamo v $x$~smeri enakomerno gibanje, v $y$~smeri pa enakomerno pospešeno gibanje.

\end{document}


Result of MWE

I think you agree with me this is totally unacceptable for a real book. The text is just too crowded, it gives 80-90 characters (including spaces) or 70-80 characters per line, and cca. 44 lines per page. I must agree with designers, this is just too crowded and unattractive for a university-freshman learning book.

Here is one of possible book designs:

EDIT: Since PGFTricks provided a bounty, I provide here the code for the picture, so you can test your ideas. It is scalable, \lmet provides the size of picture, \lms the lengths of vectors.

\tikzset{avec/.style = {->,green!75!black,line width=\wvec}}                 % acceleration vector style
\tikzset{vvec/.style = {->,red,line width=\wvec}}                            % velocity vec tor style
\tikzset{vlin/.style = {red}}                                                % velocity vector style

\newcommand{\rang}[3]{
\begin{scope}[shift={#1},rotate=#2]
\draw[#3] (5pt,0) -- (5pt,5pt) -- (0,5pt);
\end{scope}}

\newcommand\Tpro{
\begin{tikzpicture}[>=stealth,auto]
\def\lms{0.005cm}
\def\lmet{0.0007cm}

\draw[->,very thin] (-500*\lmet,0) -- (13000*\lmet,0) node[right] {$\scriptstyle x$};
\draw[->,very thin] (0,-500*\lmet) -- (0,5000*\lmet) node[above] {$\scriptstyle y$};
\draw[very thin] (500*\lmet,0) arc (0:60:500*\lmet);
\node at +(30:500*\lmet+8pt) {$\alpha$};

\draw[vvec] (0,0) -- +(60:360*\lms) node[midway] {$\vec{v}_0$};
\draw[vlin] (0,0) -- +(180*\lms,0) node[midway,swap] {$v_{x0}$} -- +(60:360*\lms) node[midway,swap] {$v_{y0}$};
\rang{(180*\lms,0)}{90}{vlin};
\draw[vvec] (2372*\lmet,3240*\lmet) -- +(180*\lms,180*\lms) node[midway] {$\vec{v}_1$};
\draw[vlin] (2372*\lmet,3240*\lmet) -- ++(180*\lms,0) node[midway,swap] {$v_{x1}$} -- ++(0,180*\lms) node[midway,swap] {$v_{y1}$};
\rang{(2372*\lmet+180*\lms,3240*\lmet)}{90}{vlin};
\draw[vvec] (5612*\lmet,4860*\lmet) -- +(180*\lms,0) node[midway] {$\vec{v}_2$};
\draw[vvec] (8852*\lmet,3240*\lmet) -- +(180*\lms,-180*\lms) node[midway,swap] {$\vec{v}_3$};
\draw[vlin] (8852*\lmet,3240*\lmet) -- ++(180*\lms,0) node[midway] {$v_{x3}$} -- ++(0,-180*\lms) node[midway] {$v_{y3}$};
\rang{(8852*\lmet+180*\lms,3240*\lmet)}{180}{vlin};
\draw[vvec] (11224*\lmet,0) -- +(-60:360*\lms) node[midway,swap] {$\vec{v}_4$};
\draw[vlin] (11224*\lmet,0) -- +(180*\lms,0) node[midway] {$v_{x4}$} -- +(-60:360*\lms) node[midway] {$v_{y4}$};
\rang{(11224*\lmet+180*\lms,0)}{180}{vlin};
\draw[avec] (5612*\lmet,2430*\lmet) -- +(0,-180*\lms) node[midway] {$\vec{a}$};

\draw[densely dashed] (0,0) parabola bend (5612*\lmet,4860*\lmet) (11224*\lmet,0);

\filldraw[thick,fill=white] (0,0) circle (100*\lmet);
\filldraw[thick,fill=white] (2372*\lmet,3240*\lmet) circle (100*\lmet);
\filldraw[thick,fill=white] (5612*\lmet,4860*\lmet) circle (100*\lmet);
\filldraw[thick,fill=white] (8852*\lmet,3240*\lmet) circle (100*\lmet);
\filldraw[thick,fill=white] (11224*\lmet,0) circle (100*\lmet);

\end{tikzpicture}}

-
In KOMA-Script, almost everything can be configured. You can try a different basis for the type area calculation by adding DIV=7 to the document class options and then changing the number to your taste (IIRC 9 is default and smaller numbers give larger margins). Have a look at the KOMA manual (enter texdoc scrguien on the command line to open the documentation if you are using TeX Live) to find all these configuration options. –  Chris Sep 25 '13 at 16:25
KOMA-Script tries to find a margin setting that fulfills the 60–70 chars per line rule but since this is don by the class it may not see your font changes. Try to \recalctypearea after all font settings, that can help. See the manual for more information on that … –  Tobi Sep 25 '13 at 16:32
Before you start complaining, you should study the »KOMA-Script« user guide. –  Thorsten Donig Sep 25 '13 at 17:06
Any LaTeX class can be re-worked to meet pretty much any specification. The memoir class is quite well documented and the first half of the documentation will provide you w/ the typography grounding which I believe you'll need to be successful w/ customizing any documentclass. FWIW, I don't like spacing in between paragraphs and prefer indentation. –  WillAdams Sep 25 '13 at 19:24
It's better to improve the question, as you did, than to post a new one in this case. So I reopened (of course, new close votes are allowed). Perhaps there's a chance to give a structured answer for a good approach. –  Stefan Kottwitz Sep 26 '13 at 10:59

As pointed out by Kurt, your questions is currently not really answerable. So this is more a "meta answer" regarding your key point:

The point is: I can get a designer, which will tell me what s/he wants, margins, fonts, frames, etc. The question is, (a) can an average LaTeX user like me do that and (b) which class to start with?

I am convinced, the answers are (a) "Yes, with some help from this community", and (b) "start with the class you are currently using".

Get that designer and her specifications. Break them down into smaller chunks, prepare a minimal working example of your book and than ask dedicated questions for each aspect to implement, such as:

• "How to get Tufte-like margins with the KOMA book class?"
• "Which package should I use for framed theorems?"

and so on, each of it with the respective specifications of your designer. I am more than convinced that your questions will be answered.

Regarding the class: The KOMA book class is one of the most flexible and well-designed LaTeX classes, so it probably is a good starter anyway. The main point, however, is that you are already using it. Before investing time in trying other classes, just get that specifications clear and seek for help where necessary.

-
Thanks for the answer. In a way I was already working in line with your instructions. I found the answer on frames in another thread tex.stackexchange.com/questions/134984/…. –  Pygmalion Sep 26 '13 at 17:02

We will help you to realise the design. I've got zero experience with equations, but I bet somebody will help you, if you just show a design and ask.

KOMA-script comes with a long manual, in English and German. I took me five minutes to develop the first solution (Linux Libertine has to be replaced by the fonts you like) and quite some time and a little help (see comments below) to develop this solution:

\documentclass[12pt,parskip=half, DIV=calc, BCOR=10mm, x11names]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern, libertine}
\usepackage{amsmath, xcolor, tcolorbox, empheq}

%\input{slike_1} % TikZ pictures

\setcounter{page}{3}

\renewcommand{\textit}[1]{\textcolor{LightBlue4}{\emph{#1}}}
%\tcbuselibrary{skins,breakable}
\tcbuselibrary{theorems}
\tcbset{colback=blue!60!green!10!white,
colframe=LightBlue4!50!black, ams nodisplayskip}

\begin{document}

\section{Zbirka vaj fizike za studente gradbenistva}
\label{sec:zbirka-vaj-fizike}

\textit{Enakomerno večdimenzionalno gibanje} označuje gibanje, pri katerem je vektor hitrosti konstanten.  Gibanje tem primeru opisuje enačba, ki je posplošitev enačbe~(...)
%

$$\tcboxmath{\vec{r} = \vec{v} t + \vec{r}_0,\label{k-umm}}$$

%
kjer $\vec{r}$ označuje trenutni, $\vec{r}_0$ pa začetni položaj telesa.  Vektorju $\text{r}$, ki označuje položaj telesa, pravimo tudi \textit{krajevni vektor}.

\textit{Enakomerno pospešeno večdimenzionalno gibanje} označuje gibanje, pri katerem je vektor pospeška~$\vec{a}$ konstanten.  Gibanje v tem primeru opisujejo enačbe, ki so posplošitve enačb~(...)
%

\begin{empheq}[box={\tcbhighmath[colback=blue!60!green!10!white,
colframe=LightBlue4!50!black]}]{align}
\vec{r} &= \tfrac{1}{2} \vec{a} t^2 + \vec{v}_0 t + \vec{r}_0\label{k-uamm1}\\
\vec{v} &= \vec{a} t + \vec{v}_0 \label{k-uamm2}\\
v^2 &= v_0^2 + 2 \vec{a} \cdot (\vec{r} - \vec{r}_0) \label{k-uamm3}
\end{empheq}

%
kjer so $\vec{r}$ trenutni in $\vec{r}_0$ začetni krajevni vektor telesa, ter $\vec{v}$ trenutni in $\vec{v}_0$ začetni vektor hitrosti telesa.  Pri tem je tretja enačba izpeljana iz prvih dveh.

\begin{figure}[!ht]
\centering
%\Tpro
\caption{Poševni met}
\end{figure}

Če se telo nahaja v bližini Zemeljske površine, nanj deluje konstantni pospešek prostega pada $g = 10$~m/s$^2$ navpično navzdol.  Vsako tako gibanje telesa je dejansko \textit{dvo}-dimenzionalno, saj se telo giblje po navpični ravnini.  Po dogovoru $y$~os usmerimo navpično navzgor, torej nasproti smeri pospeška prostega pada ($\vec{a} = - g \vec{j}$), $x$~os pa tako, da začetna hitrost leži v $xy$ ravnini $\vec{v}_0 = v_{x0} \vec{i} + v_{y0} \vec{j}$.  Potem lahko vsako od enačb~(...) razstavimo na \textit{dve} skalarni enačbi in dobimo
%

\begin{empheq}[box={\tcbhighmath[colback=blue!60!green!10!white,
colframe=LightBlue4!50!black]}]{align}
x(t) &= v_{x0} t + x_0, \label{k-prsx}\\
y(t) &= -\tfrac{1}{2} g t^2 + v_{y0} t + y_0, \label{k-prsy}\\
v_x(t) &= v_{x0}, \label{k-prvx}\\
v_y(t) &= -g t + v_{y0}. \label{k-prvy}
\end{empheq}

Pri tem smo upoštevali, da je pospešek v $x$~smeri enak $a_x = 0$, pospešek v $y$~smeri pa $a_y = -g$, kar pomeni, da imamo v $x$~smeri enakomerno gibanje, v $y$~smeri pa enakomerno pospešeno gibanje.

\end{document}


The figure is missing, because you did not provide it. I took for the purpose of demonstration you headings.

Hey, use KOMA-script, study the manual and find a solution for displaying your formulas and you will have your book in very short time!

-
This actually looks awesome. I already found the solution for frames elsewhere. I'll combine that with your solution over the weekend and go back to the designer. Maybe there is a hope! Just a question: is it possible to put marginal note and marginal picture? –  Pygmalion Sep 26 '13 at 15:25
@Pygmalion You remember Radio Yerevan? »Yes, it is possible to have marginnotes (see the package marginnotes), marginparagraphs (with \marginpar{}) and pictures in the margin. But it is not possible to have text in the margin, which goes on after a pagebreak.« To use a margin column as if it were a column on a page, the text in the margin always has to be shorter than the paragraph on the page, to which it is connected, e.g. by using the parcolumns package. All this is very messy, because LaTeX does not support it natively. –  Keks Dose Sep 26 '13 at 15:48
OK I got the point. I might look sloppy, but the most important lesson that comes from your post is that it is OK (or even a good idea) to start with scrbook. I will study your example and only if necessary turn to you back. Thanks. –  Pygmalion Sep 26 '13 at 16:59
@barbarabeeton Just use \begin{tcolorbox}[ams nodisplayskip]\begin{align}...\end{align}\end{tcolorbox} to remove the blank line. Or even shorter: \begin{tcolorbox}[ams align]...\end{tcolorbox} which sets the content automatically with align. –  Thomas F. Sturm Sep 27 '13 at 17:04
@KeksDose Yes, in combination with the nice empheq package, see tex.stackexchange.com/questions/134984/… –  Thomas F. Sturm Sep 27 '13 at 17:22

Too long for an comment:

Your "MWE" shows no example page (only one line "Text ..."), you didn't include an picture to show your case.

If class tufte supports your wished margin, a try could be to locate that code and change it to be useable in KOMA-Script. Or to change tufte class to fit your wished. But you didn't tell us what is "unlikeable" with tufte, so we can't help you here.

A real MWE could be:

\documentclass[
fontsize=12pt
,DIV=7          % bigger margins
,parskip        % space between parapraphs
]{scrbook}

\usepackage{blindtext} % creates Blindtext/document
\usepackage{showframe} % shows typing area and margins

\begin{document}

\Blindtext

\end{document}


resulting in two pages, using package blindtext to generate blindtext.

That could be a start to create an own MWE showing us your problem.

-
Thank you for your suggestion. Obviously I was not clear enough. Comparing tufte class and scrbook class, in my view Tufte wins only regarding the page layout (margins, marginal note commands etc.) So I would expect that it would be easier to adapt scrbook class using some tufte class code. Actually I do this type of stuff occasionally to redefine commands. The problem is that page layout code is the most complicated and overwhelming part of the code, so for my level of TeX knowledge reimplementation to other package and avoid possible conflicts ... it is mission impossible. –  Pygmalion Sep 25 '13 at 22:56
If the problem is only margins and marginal notes, you can change that using the geometry and footmisc packages. Otherwise, as Kurt said, we don't know exactly what results you want to achieve. You could post a MWE and the different, desired result. –  Joseph Sep 26 '13 at 0:11
@Joseph OK, I'll do that. –  Pygmalion Sep 26 '13 at 9:09

Springer prepared templates for its authors. The one for monographs is called svmono and is available here.

You might want to get information on potential copyright issues, adapt it to your liking, or use it for inspiration. It is, I think, comparatively well documented and thoroughly thought through.

Additionally, compared to a lot of templates for monographs in the LATEX-world the style follows a rather professional audience-oriented design philosophy. It doesn't employ a wealth of typefaces, font-sizes, colors, frames, indents, etc. In my opinion, this is the preferable way to design book interiors if they are meant for (semi-) continuous reading by a (semi-) professional audience. As nicely summarized in a post on typophile by a university press-focused book designer one can basically think of two "approaches" when it comes to designing pages in a book. One is to concentrate on integrating heterogeneous elements (math, graphs, tables, notes, various kinds of footer and header content, levels of headings, body text, etc.) into the page and the other is emphasizing their heterogeneity (think of designing a book for children or one for discontinuous reading).

Said book designer, by the way, seems to work with a proprietary adaptation of TEX.

-
I am using Tufte for one project (a textbook for a laboratory-oriented course, in which large margins are useful) and Springer for another (a conventional book). Although I have little idea what the original question was aimed at, I can say that (a) both these classes work well in practice. Then again, I think the default latex book class is reasonably good. I'm not sure what the problem is, but there are many good solutions already stated on this discussion thread. –  dank Oct 1 '13 at 19:22
svmono does seem like a veeery nice choice! It seems like a very complete and good looking template. Is it easy to use? –  Felipe Aguirre Oct 1 '13 at 22:34

One place to find someone to implement a design is the TUG Consultants page.

-
The accent is on modest lump of money to find a designer and implement design ideas myself (because no one else would do that for the money provided). And, yes, I, as an author, won't get a nickel out of the book. I was idealistically prepared to put some work into it for no money, but had I known how it is problematic to design a book in LaTeX I would never start writing in the first place. –  Pygmalion Sep 26 '13 at 11:53
@Pygmalion Do you have already the design specification (page size, margins, font, chapter openings, ...? If so, I could try to help you with the implementation. You can contact me at textnik. The site is still on testing. –  TeXtnik Sep 26 '13 at 12:42
@zunbeltz Thanks. The general idea is as shown above. But don't waste your time yet. Momentarily I must get a general idea - is this possible to do without engaging a professional (the only alternative is designing out of LaTeX), where to start from (basic class), how much can I do myself (as much as possible, of course)... For example, I've already got the answer how to make frames in another thread, tex.stackexchange.com/questions/134984/… –  Pygmalion Sep 26 '13 at 12:52
@Pygmalion The link I provided is my own page. Not a professional yet! :-). I just send it so you can have an email address to contact me. The firs thing is to have a clear idea of the page/textblock shape you want; and the font. We can them adjust each other to get a reasonable character per line and line per page ratios. –  TeXtnik Sep 26 '13 at 13:22

There are many templates out there (e.g.). What I'd do is:

1. search for a bunch of templates
2. check what bits and pieces I like from each one
3. choose the one that is most similar to what I want, copy it, this is my template now
4. combine the parts I like from the other templates into my template
5. for the specific aspects that are missing and I found no examples, Google and then ask here

There is also a faster path, wrt: "There is a big pool of good book designers out there, but not one has ever wrote a command in LaTeX", what you could do is:

1. find one
2. rejoice

There have to be some freelance programmers out there that can do something that looks nice on LaTeX, the world is full of people and the language doesn't really matter because you will be providing the contents.

-
Actually I did came across tufte-style, but apart from the page layout (margins, marginal notes) it is just not right for the purpose. –  Pygmalion Sep 26 '13 at 12:27
@Pygmalion well, that was just an example. It has been so long since the last time I read a paper book that I cannot even understand the problem. –  Trylks Sep 26 '13 at 20:37

Is it possible for a non-professional semi-experienced LaTeX user to implement design ideas to the document himself and save his precious work? Which document class should s/he start with?

LaTeX is technically capable of duplicating the sample you provided from the book designer. Whether you'll be able to implement the design seems to depend mostly on how much time you can invest in the process (which we don't know).

In my experience, it is possible to duplicate very colorful, attractive templates (e.g., created with inDesign) in LaTeX as a semi-professional. It requires having a clearly specified template file (e.g., you want to know all the RGB values of the colors used, the fonts, the distances [e.g., for margins], the leading, etc.). And then it's a matter of taking each element in turn and implementing it in your template.

In terms of putting you on the right path, I recommend to use the memoir class, which comes with a lengthy and detailed manual. This manual steps through most of the points that you will need to implement for a book design (e.g., title page, front matter, margins, headings, margin notes, etc.). It's all there, and it tells you how to implement each of these using the memoir class. In addition, the author of that package has produced a supplementary book on book design principles in general. You might not need to get into this supplementary book however, since someone else will be handing you the book design. Still, it might help you know what needs to be covered in the book design that you commission.

In the unfortunate case that you won't be able to implement the template yourself and can't hire someone else to do it for you, I recommend to look into a tool called pandoc. Pandoc is a command line tool that converts documents to different formats including LaTeX. You could run pandoc on your LaTeX file and generate a plain text file with the contents. This would at least be an efficient way to get your text extracted from all the LaTeX formatting commands that it's currently sitting in. Then, I assume you would hand it over for typesetting in InDesign or something similar.

There are a few other posts on Stack Exchange that are relevant, but since this is a new account, I can't include any more links in this response. I recommend to search the site for "book design" and review the results.

-