Technical documentation and/or book templates?

I'm just getting started with LaTeX and wanted to see some templates for technical documentation and/or books. I'm writing a small book about PHP and wanted to use LaTeX with it, but i wanted to have more control about the appearance (header, footer, "tips" with icons, code samples, table of contents, etc.)

asked Jun 6, 2011 at 18:18 123 1 1 silver badge 4 4 bronze badges Do you have (La)TeX distribution installed on your machine? Commented Jun 6, 2011 at 20:22 This might help: tex.stackexchange.com/q/4420/215 Commented Jun 6, 2011 at 21:26

I suggest you get your self familiar with basic terms first. For example read the "not so short introduction". Get your feet wet first and start with small questions. It is not because people won't able to answer your question, but I doubt they may be little help to a newbie. What you are asking is class. And it requires about a third of the book LaTeX companion to answer all your questions here. So, one step a time.

Commented Jun 6, 2011 at 22:57

Get either memoir or the KOMA bundle, and start typing away. It is not so hard to fix mistakes later on (even radically switch clases!), and the best way of learning is just trying stuff and reflecting on what works and what doesn't. Look at books not for their contents but for their look and feel. Check out the various galleries (like the MemoirChapStyles gallery of chapter headings or the titlepages gallery)

Commented Jan 17, 2013 at 12:23

2 Answers 2

Your post contains many questions that should be better asked in separate post each. Since you are new to LaTeX and you might want to start writing your book immediately without spending too much time to learn LaTeX in details --- I think you don't need to spend much time to learn how to typeset math, right? --- I guide you how to create the skeleton that will be improved later.

Changing the footer, header, table of contents can be done later without destroying this skeleton. :-)

Step 01

You should start organizing your project from the beginning. Divide your project into at least 3 sub directories, namely MyProject\Contents , MyProject\Images , and MyProject\Codes .

Step 02

Create your own document class, namely mybook.cls as follows and save it in MyProject directory.

\ProvidesClass[2011/06/07 v 0.01 my own class (hv)] \DeclareOption*<\PassOptionsToClass<\CurrentOption>> \ProcessOptions\relax \LoadClass [ %other default options go here ] \newcommand\ContentsPath \newcommand\ChapterPath <\ContentsPath>\newcommand\SectionPath <\ChapterPath>\newcommand\SubSectionPath \@ifclassloaded  < \newcommand\IncludeChapter[1] < \renewcommand\ChapterPath<\ContentsPath#1/>\include <\ContentsPath#1>> \newcommand\IncludeOnlyChapter[1] < \includeonly<\ContentsPath#1>> ><> \newcommand\InputSection[1] < \renewcommand\SectionPath<\ChapterPath#1/>\input <\ChapterPath#1>> \newcommand\InputSubSection[1] < \renewcommand\SubSectionPath\input > \newcommand\InputSubSubSection[1] < \input> \@ifclassloaded  < \newcommand\Chapter[1] < \chapter%\addcontentsline > ><> \newcommand\Section[1] < \section% %\addcontentsline > \newcommand\SubSection[1] < \subsection%\addcontentsline > \newcommand\SubSubSection[1] < \subsubsection%\addcontentsline > \RequirePackage \RequirePackage \lstdefinestyle < breaklines=true, tabsize=3, showstringspaces=false, aboveskip=0pt, belowskip=0pt, extendedchars=\true, language=PHP, frame=single, %=========================================================== framesep=3pt,%expand outward. framerule=0.4pt,%expand outward. xleftmargin=3.4pt,%make the frame fits in the text area. xrightmargin=3.4pt,%make the frame fits in the text area. %=========================================================== rulecolor=\color% > \lstdefinestyle < style=Common, backgroundcolor=\color, basicstyle=\scriptsize\color\ttfamily, keywordstyle=\color, identifierstyle=\color, stringstyle=\color, commentstyle=\color > \newcommand<\IncludeCode>[2][style=ThemeA] < \lstinputlisting[#1,caption=<\href>] > \RequirePackage[colorlinks=true,bookmarksnumbered=true,bookmarksopen=true] \RequirePackage[all] \RequirePackage \makeindex \endinput 

Step 03

Create the main input file, namely main.tex as follows and save it in MyProject .

\documentclass[dvipsnames,cmyk,12pt] \usepackage[a4paper,vmargin=15mm,hmargin=10mm] \title \author \date %\IncludeOnlyChapter \begin \frontmatter \maketitle \thispagestyle \tableofcontents \lstlistoflistings \mainmatter \part \IncludeChapter \IncludeChapter \part \IncludeChapter \IncludeChapter \appendix\renewcommand \part \IncludeChapter \backmatter \printindex \end

Step 04

Create a file for chapter Variables , namely Variables.tex , as follows and save it in MyProject\Contents .

\Chapter \InputSection \InputSection

Step 05

Create a directory MyProject\Contents\Variables .

Step 06

Create a file for section Declaration , namely Declaration.tex , as follows and save it in MyProject\Contents\Variables .

\Section \IncludeCode[style=ThemeA] 

Step 07

Do the same for the remaining contents.

It is also worth using VCS (versioning control system) such as Subversion or Git to manage your project.

If there is any question, give a comment. :-)

answered Jun 6, 2011 at 19:48 Display Name Display Name 47.4k 49 49 gold badges 190 190 silver badges 337 337 bronze badges Within lists, code blocks have to be indented four additional spaces. Commented Jun 6, 2011 at 19:57 @lockstep: Done but with different methods. Commented Jun 6, 2011 at 19:59

I have to agree with using VCS and splitting up the text into separate files for chapters or other divisions. Don't worry, just fling new stuff into the file where it fits. You can reorder all bu shuffling the includes around later. LaTeX is (mostly) free form, indent your source and end lines at logical points (after puctuation, one idea per line, . ). That makes editing easier when you need to restructure a sentence. If you keep your changes line-oriented, your version control system won't show noise (i.e., a whole paragraph change just because you added a word and reflowed the text).

Commented Jan 17, 2013 at 12:30

If you are new to LaTex, I'd start gently. Read the standard introductions (such as the not so short introduction). Rather than jumping into producing your own class file immediately, I'd be inclined to start with one of the commonly used classes (probably memoir or scrbook ); each of those has good manuals with plenty of customization suggestions for the sort of things you are most likely to want to customize. Frankly, you are probably better picking one and sticking with it (and spending time with the documentation) than agonizing over the choice, since you can customize the appearance of the final product to your taste in due course.

Since you are writing a book about php, you may want some sort of package to deal with listings. I don't have the expertise to make a recommendation on that. But for all sorts of other useful stuff, have a look at this answer on the packages people regularly load.

Definitely learn about the things like \include and \includeonly , todonotes , bibtex (or, probably nowadays, biblatex ) which help keep things organised and modular while you are writing.

My last suggestion might be controversial. Tempting as it is to try fiddling with things like section headings, styles and like at the outset, I'd be inclined to get on with writing the text first. By all means use a standard set of semantic markup commands ( \chapter , \section , \footnote and so forth), but leave worrying about things like fonts and the like until the basic shape of your text is clear to you, since design needs to some extent to follow content. At that point, you are going to need to make design decisions; for that you need to spend some time thinking about the sort of look you like, and why you like it, and would be well-advised to read something, like Bringhurst's The Elements of Typographic Style written by someone who actually knows what s/he's talking about when it comes to book design.