14

I wish to turn several of my blog article series into a PDF e-book but I have never used LaTeX before for creating books.

For example, I want to take my Awk One-Liners Explained article series, improve it and turn it into a book.

I'll probably start with this guide that I found - http://www.math.mun.ca/~edgar/thesis.html But that is just a small template. Any other tips, tricks and suggestions for doing it?

6
  • @Peteris Krumins for general tips about typography look at are-there-any-good-general-typesetting-books-references
    – pmav99
    Apr 28, 2011 at 10:31
  • @Peteris: Welcome to tex.sx! It's not necessary to sign your questions (as there is already a box with your username below it) or to begin them with a greeting.
    – doncherry
    Apr 28, 2011 at 10:31
  • Are you going to rewrite your articles afresh or do you want to convert from whatever-format to LaTeX first? Apr 28, 2011 at 11:09
  • Peteris: I mention that because converting to LaTeX is much easier than converting from, and there may be a half-decent converter already in existence for whatever format you wrote your blog posts in. Apr 28, 2011 at 12:12
  • For example, if you happened to write blog posts using something like Markdown, Pandoc may be able to give you a good first-cut translation into LaTeX.
    – Sharpie
    Apr 28, 2011 at 22:41

3 Answers 3

13

I think that you should try using either scrbook or the memoir document class. They are designed for this kind of work. IMHO Memoir has better documentation so you'll propably find it easier to configure it the way you want it.

There is also memdesign, which used to be part of the documentation of memoir.

3
  • Of course (as you hinted with “IMHO”) “better documentation” is highly subjective. I find the KOMA-Sript book to be a very good documentation.
    – cgnieder
    Dec 21, 2012 at 14:06
  • @cgnieder I said that I think that memoir has better documentation. I didn't claim that KOMA-Script's was bad. Also it has been a year and a half since the post. Perhaps things have changed since then.
    – pmav99
    Dec 22, 2012 at 21:45
  • @pmav99 I did get that. I tried to say that I disagree. But then I am German and until only a few months ago the English documentation to KOMA-Script was bad if existent at all, unlike the German one which has been published as a book, so ...
    – cgnieder
    Dec 22, 2012 at 21:52
6

If you don't have TeX habbits yet, I'd recommend using Koma-Script's scrbook right away instead of the book class.

Also, you might want to have syntax highliting for your examples. I'd recommended using minted for that, as it is quite flexible and powerful.

5
  • @Raphnik + 1 for minted. An alternative is texments
    – pmav99
    Apr 28, 2011 at 10:18
  • @pmav99: Ah nice, I didn't know there was another Pygments package.
    – raphink
    Apr 28, 2011 at 10:20
  • 2
    listings is a native LaTeX package for code listings and syntax highlighting. It does not require Python or shell escaping.
    – ipavlic
    Apr 28, 2011 at 10:25
  • That is true, but texments is much easier to configure.
    – pmav99
    Apr 28, 2011 at 10:29
  • and flexible... I've had to make syntax highlighting for non-standard languages, and writing Python modules for that is very easy.
    – raphink
    Apr 28, 2011 at 10:33
6

From the comments,

Andrew, I am going to copy/paste the text into Latex file, I think. And then re-format it so it actually looked good. – Peteris Krumins

It would be absolutely heretical and the greatest of programming sins for a blog that focuses on programming to cut and paste content from a CMS into a LaTeX text file!

TeX is more than just a typesetting system. It's a full-fledged programming language and Turing complete. Although it might arguably at first glance appear insane to have a Turing complete programming language for a task like typesetting it makes sense the more you explore the needs of a typesetting system.

No other software implemented in the 1970s remains absolutely and unquestionably dominant in its domain other than TeX and the collection of macros known as LaTeX, which was developed in the eighties. The typesetting algorithms developed by Knuth and the glue-and-boxes model of text layout was a piece of absolute genius. One of the most masterful examples of capturing an extremely complex problem using an extremely simple model. It's beautiful and you are now using it in a somewhat different and handicapped way to display content within a browser. This is the part of TeX that is amazingly, gloriously, magnificently brilliant.

Welcome to our community, pick up a bit of skills in TeX/LaTeX programming and use whatever language you are comfortable with to pick up the content from your database and automatically generate the LaTeX content. For a person with your computer skills it shouldn't take more than two weekends.

Here is some code for inspiration:

\documentclass{article}
\long\def\aPieceOfCode{%
  This is a Piece of code that I need to type out in a number of ways.
  First pick the contents from the CMS and store it in macro. Then call them through your typesetter macros and hey it can even display maths \formula\ without the use of JavaScript!
}
\def\formula{$a=b^2+23 $}
\def\displayMyCode#1{#1}

\begin{document}
\displayMyCode{\aPieceOfCode}
\end{document}
2
  • Ahh... but extracting the code out of some arbitrary markup and into your \def, now that is a tricky problem. Also, not a problem TeX is particularly good at solving---despite being turing complete. TeX is an amazing piece of work, but it has a very narrow focus.
    – Sharpie
    Apr 29, 2011 at 0:58
  • @Sharpie Depends. If you have been storing html code in the CMS then it is hard, but if you have been storing it as for example wiki markup then it is easier. Apr 29, 2011 at 4:06

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