Txt2tags is a command line document conversion tool which helps you generate multiple file formats from a single text file with minimal markup.

You can convert your text file to the following 9 file formats using txt2tags command line tool.

  • HTML
  • XHTML
  • SGML
  • LaTeX
  • Lout
  • Man page
  • MoinMoin
  • Magic point
  • Pagemaker

txt2tags Structure

txt2tags file structure can be broadly divided into three namely – Header, Settings, and Body. The Header and Settings are optional.

txt2tags file structure

txt2tags file structure

txt2tags Syntax

txt2tags file has a very easy to use syntax for the body. If you have used Wiki syntax, you will be perfectly at home with the txt2tags syntax as well. The following is a subset of the syntax used in txt2tags file.

  • Title  = words =
  • Numbered Title  + words +
  • Bold  **words**
  • Italic //words//
  • Underline __words__
  • Monospaced ``words``
  • Quote <tab>words
  • List  - words
  • Numbered list + words
  • Verbatim line ``` words
  • Verbatim area ``` <linebreak> lines <linebreak>```
  • Table  | cell1 | cell2 | cell3
  • Links  [label url]
  • Images [filename.jpg]
  • Comments % comments

txt2tags Usage

The following are a few examples of how txt2tags command line document convertor is used to convert a text file to multiple file formats.

Convert to HTML

$ txt2tags -t html filename.t2t

The output will be an html file of the same name (filename.html).

Include Table of Contents in your HTML file

$ txt2tags -t html --toc filename.t2t

The --toc option will automatically include a table of contents in the HTML file. Please note that you have to include the macro %%toc somewhere within your txt2tags file for the table of contents to be inserted in that location.

Convert to PDF

There is no direct way to convert to PDF. A roundabout way is to convert the txt2tags file to latex and then use the pdflatex tool to convert the LaTeX file to PDF as shown in the following example.

$ txt2tags -t tex filename.t2t
$ pdflatex filename.tex

How to install txt2tags

Most Linux distributions contain txt2tags in their repositories. For example, you can install txt2tags in Ubuntu Linux as follows :

$ sudo apt-get install txt2tags python-tk

Fedora, OpenSuSE, Mandriva, all have txt2tags in their repositories; and you can install txt2tags in these Linux distributions using their respective package management tool.

Windows users can download txt2tags installer from here. Also visit the txt2tags home page.

txt2tags GUI

If you have installed the Python TKinker extension (python-tk) , then you can start the txt2tags GUI as follows :

$ txt2tags --gui
txt2tags GUI

txt2tags GUI

The txt2tags GUI allows you to do all the things you can do using the txt2tags command line tool.

txt2tags is no doubt a very useful tool that converts your text files to a variety of file formats. It is released under GPL and is Free.

0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.