Writing Books with Txt2tags

by Aurelio Jargas

%!target : xhtml
%!style  : writing-book.css
%!options: -n --toc --css-sugar --css-inside -o writing-book.html

%!preproc: URL_RE_BOOK  http://guia-er.sourceforge.net/
%!preproc: URL_HTMLDOC	http://www.easysw.com/htmldoc/
%!preproc: SORRY        txt2tags cannot help you
%!postproc: URL_PC_BOOK http://www.picocontainer.org/Contructor+Dependency+Injection+...+Book+Announcement


	This document is a quick guide showing the benefits of using
	the txt2tags tool on the book writing process. Also applicable
	for other large documents as Guides and Thesis.


= Preface =

I'm the txt2tags``[1]`` author and I wrote two published papers using
it: a [Regular Expressions book URL_RE_BOOK] (96 pages) and a Shell
Programming Course (108 pages). The writing process was smooth and
painless, so I want to share this experience.

A book is a real big work to get done, but it doesn't have to be a
complicated process. To write is to organize ideas into text
structures like sections, paragraphs and lists. Txt2tags is a tool
that makes this task simple and easy.

Writing alone or in a team, with or without version control, technical
contents or not, text-only or graphics-enabled. In any case txt2tags
can be used as the main tool for the book creation.

There is [a book URL_PC_BOOK] being written right now, using txt2tags.

	``[1]`` Txt2tags reads a text file with minimal markup as
	""**bold**"" and ""//italic//"" and converts it to documents
	like HTML, LaTeX and Adobe PageMaker. More info:
	http://txt2tags.org.



= Visual Editors VS Markup =

The two common ways of writing a book are to use a Visual Editor
(//Microsoft Word//, //Adobe Pagemaker//) or a Markup Language
(//LaTeX//, //docbook//).

In Visual Editors you write and format the contents at the same time.
This approach is nice for small texts, but for a 300 pages book, the
formatting consume time and distract the writer.

In Markup Languages you write contents and mark it up, so an external
program will convert it to the final form. The writer don't mind about
formatting, but the process of including ``<tags></tags>`` and
``\more{tags}`` is error prone and very intrusive, making the contents
hard to read on the sources.

Txt2tags also uses the markup schema, but the big difference is that
its marks are very minimal, some indeed are almost natural, as using
the hyphen for list items. So the writer can focus on contents only
and the source remains readable.


= The Txt2tags Approach =

Using txt2tags, the book writing process follow these steps:

+ The author(s) learn the very simple txt2tags markup rules.

+ The author writes the book contents, forgetting about noises
  like page margin, font face, colors and sizes.

+ The author (or the publisher) open the contents on a graphical text
  processor that reads HTML (or LaTeX or ...) and conclude the book
  formatting.


Step 1 is fast, just a few minutes. Step 2 will take months, and step
3 can take days or weeks.

Writing contents is when you will spend more time on the book, so it
is really important to make this process a simple, productive and
pleasant task.

The following are arguments showing that txt2tags can be used to
achieve that.


= Fast and Furious =

Time is the key. Using txt2tags you will experience a very high
productivity period because you write contents, not formatting.

- **Initial Release Fast**

  It is very difficult to start something, but txt2tags has a nice
  approach to this problem. Just sit and write plain text. When you're
  done, in a few minutes you can add all the txt2tags marks on the
  text and the document is ready to be converted and published.

- **Fast Snapshot Preview**

  No matter which will be the final book format, HTML is the preferred
  format to use on the writing time. A snapshot of the current book
  state can be done at any time, converting the sources to an HTML
  page, so any system with a browser can read it. If you need a
  printable version, convert the HTML to PDF with the excellent
  [htmldoc URL_HTMLDOC] tool.

- **Book Contents Overview**

  To quickly have a global overview of the book contents at any time,
  just use the txt2tags //TOC Only// feature. The program shows the
  current Table of Contents for the book, with the listing of chapters
  and sections, numbered or not, at any depth.

- **Fast Writing**

  Txt2tags marks are simple and minimalist, very easy to learn. No
  names, no options, no parameters. You don't have to stop writing
  contents to insert marks, they flow together with the text. If you
  don't remember a specific mark at the moment, forget about it and
  keep writing. At the end you do a global review on the text and
  quickly insert the missing marks.

- **Fast Conversion**

  Even if you have a 500 pages book, the conversion process will take
  just a moment. It is because txt2tags acts as a filter, converting
  from one format to another. It does not index, compile, calculate,
  compress, draw or do any strong processing on the sources. No more
  library, catalog, schema and DTD nightmares.


= Organize the Sources in Folders =

Txt2tags has a built in command to include external files in any part
of a document, at conversion time. It makes possible to split the
sources into several files.

- **Each chapter in a folder**

  You can make a folder for each chapter, storing the sources in a
  structured tree. Inside the chapter folder, you can even create
  subfolders to store images, configuration and included files.

- **No file conflicts**

  Separating chapters, different teams can work in different chapters
  with no interaction between them. Each team work on its own folder,
  avoiding file conflicts due concurrent changes.

- **Flexible access control**

  Files and folders organized, you can implement access control rules,
  setting up properties and permissions for any file or chapter. Do
  use the standard system tools to configure the read/write
  permissions, like the "users and groups" schema.

- **Global view of sources**

  Structuring the sources also helps to have a global view of the
  book, using any file browser to quickly know the amount of text and
  images of any chapter. (Hint: on UNIX, ``find`` and ``du`` commands)

- **Work your chapter, forget the others**

  Separating sources into files, you can convert your chapter alone,
  not needing to wait for the full book processing. Besides faster
  to convert, the chapter alone can be sent to reviewers or be
  published alone, as a sample of the full book.

- **You separate, txt2tags joins**

  When converting, txt2tags will automatically join all the chapters
  into the final book, no matter how deep or large is the folder
  tree.


= Version Control Made Easy =

Txt2tags helps the book version control with line based tools (as
//CVS// and //Subversion//). The sources are plain text, not compiled
data.

- **Work with short lines**

  You can make short lines, breaking them at 72 columns. It will help
  on the revision control, because it is line based. If the final
  format needs that a paragraph is composed by a single long line (as
  PageMaker), txt2tags will join them to you automatically.

- **Readable sources**

  With very minimal markup, the sources are readable. One can easily
  see what has changed from one version to another, the marks don't
  hide or pollute the text.

- **Large contents, small sources**

  As plain text, you can have a huge amount of contents, with a low
  disk usage. People can do full checkouts and commits even in slow
  connections.

- **Chapter versioning**

  As seen before, the sources can be organized into folders. This
  makes version control separated by chapter, or even sections of
  chapters, depending on how granulated you need the versioning.


= Quality Matters =

You can write a book. Or you can write THE book. Txt2tags has nice
built in features to increase your work quality.

- **Spell Check**

  As all txt2tags marks are symbols and not words, you can use any
  spell checker on the sources. It will take care of the text only,
  not trying to correct tags.

- **Alias Database**

  Txt2tags has //Pre Processing Filters//, where you can define
  keyword/value pairs. Wherever the keyword is found on the sources, it
  is expanded to the given value at conversion time. For example, you
  do use the string ``URL_GOOGLE`` on your text and it will appear as
  ``http://www.google.com`` on the book. If the Google URL changes,
  you just change the filter definition and all occurrences of it will
  be updated. You can define as many keywords as needed, with no
  maximum limit.

- **Dynamic Content**

  Txt2tags also has a command to include pre-formatted text into the
  document when converting it, for example, a software source code
  sample. This way you can keep this code sample separated from the
  book text and update it by hand or even automatically. A nice idea
  is to mark the software source code with special comments, and a
  little program extract these marked parts into separate files.

- **Control Over the Result**

  Txt2tags has //Post Processing Filters//, where you can define rules
  that makes adjustments on the resulting document. So if the standard
  txt2tags conversion does not fully satisfy your needs, you can
  improve it with your own filters. You can use the power of the
  Regular Expressions to match patterns.


= Other Advantages =

And there is more!

- **Separate Formatting from Contents**

  Using HTML as the development target format, you can also use CSS
  files to experiment different book looks. CSS defines formating for
  HTML pages, and there is graphical editors to create CSS files.
  A team of designers can work on doing CSS files for the book, while
  the writers keep writing.

- **Include Complicated Structures**

  Txt2tags does have support for all the common structures used in
  texts: lists, definitions, quotation, verbatim area and tables. But
  if some parts of your book requires a more complicated structure,
  you can use the //Tagged Include// feature, where you insert text
  that is already tagged, like a real fancy HTML table. With txt2tags,
  exceptions are not a problem!

- **Do Use Any Editor**

  As plain text source files, even the most modest text editor in the
  world can be used to write the book. It doesn't have to have any
  feature besides write and save text. If you use the editors with
  txt2tags support, you will have //Syntax Highlight//, which helps to
  identify the txt2tags marks. They are: Vim, Emacs, Kate, Nano, gedit
  and TextMate.

- **Technical Support**

  Txt2tags has various channels to get technical support: two mailing
  lists (english and portuguese), an IRC channel and even an Orkut
  community. And for book projects, your can send direct e-mails to
  the program author, who will give priority on the answer.


= No Tool Fits All Needs =

There are some special cases where txt2tags is not a good tool for
writing books.

- **Very Complex Books**

  Books that uses lots of complicated tables, formulas or specific
  structures, needs a graphical editor or a more complex markup
  language, as LaTeX. If your book matches this description, SORRY.

- **Footnotes**

  Txt2tags does not have footnotes support. If you will use just a
  few, you can add them later. But if you plan to make an intense
  footnotes use, SORRY.

- **References for Pages, Tables and Images**

  One can use a graphical editor at the publishing time to include
  indexes for pages, tables and images, no problem at all. But if you
  plan to refer to them inside the text like
  "//See table 4.11 on page 35//", SORRY.


----------------------------------------------------------------------
//Writing Books with Txt2tags - Oct/2004//
([see source %%infile])

