3 Compiling Documents

eCromedos documents are written in eCromedos Markup Language (ECML), which is XML-based markup very similar to HTML. To translate an ECML document to one of the supported output formats, you call the eCromedos Document Processor from the command line.

3.1 Generating HTML

The default output format is HTML. Let us assume, you have written a document in ECML and saved it to the file test.xml. To transform this document to HTML, you simply type

$ ecromedos test.xml

You should preferably call this from a separate directory, to avoid having the output files in the same directory as the source files. Let us say, the source document is located in your home directory in the subfolder documents. Simply create another subfolder at the same level, change into it and call ecromedos from there. For example:

$ cd ..
$ mkdir output
$ cd output
$ ecromedos ../documents/test.xml

3.2 Generating LATEX

To generate LATEX output from an ECML source file, you have to call ecromedos with the -f command line switch:

$ ecromedos -f latex ../documents/test.xml

Depending on your setting of secsplitdepth (see below), you will obtain one or more output files with the extension “tex”, where the main file will carry the name of the document class you used. I.e. if the root node of your document is book, the main LATEX file will be called book.tex.

To compile this file, you have to invoke the LATEX parser:

$ latex book.tex

Note LATEX usually needs two or three passes to build a complete document. On the first run, LATEX saves intermediate results in auxiliary files which are reused in consecutive runs to construct, among other things, the table of contents.

The result will be a file named book.dvi. DVI is a device-independent page description language. You can use the following commands to convert the DVI file to PostScript and PDF:

$ dvips -Ppdf book.dvi
$ ps2pdf book.ps

This will generate the files book.ps and book.pdf, respectively.

3.3 Output Options

There are various attributes that you may set on the root element of a document, to control the document processor's behavior or influence the layout mechanisms of the formatting engine, i.e. your web browser or the LATEX parser.

3.3.1 Chunking into Multiple Files

Use the secsplitdepth attribute in order to control, to which depth of sectioning the document will be split into individual files. For example, if you are writing a book and set secsplitdepth equal to one, every chapter will be written to a separate file.

When generating HTML output, it is always a good idea to chunk large documents into smaller parts. This will provide a better user experience, since single parts will load more quickly, especially over low-bandwidth connections, and the user's web browser does not have to keep the entire document in memory, at once.

3.3.2 Specifying the Document Language

The lang attribute is used to select the language for automatic titles, i.e. titles that are generated by the document processor and not by the user, such as “table of contents” or “bibliography”. When generating LATEX output, this also selects the hyphenation patterns for the specified language.

In version 1.0, eCromedos supports three languages, namely english, german (default) and spanish. Language support will be extended in future releases.

3.3.3 Chapter and Section Numbering

The secnumdepth attribute controls, to which depth in the section hierarchy sections will be numbered. Setting this to zero will result in the document having no section numbers, at all.

3.3.4 Generating the Table of Contents

During transformation, the document processor will automatically generate a table of contents (TOC) for your document. You do not need to, and in fact you cannot, create the TOC manually.

You can specify, to which depth sections should receive an entry in the TOC, by setting the tocdepth attribute appropriately. If you set this to zero, no TOC will be created, unless you are generating HTML and are chunking the output into multiple files.

3.3.5 Options for Printed Output

Use the papersize attribute to specify your printer's paper format. The default is a4paper which is the standard office paper size in Germany. Possible values are all ISO standard paper formats and in general all formats that the LATEX package KOMA-Script ([2]) can deal with.

The bcor attribute lets you specify a bind correction. That is the amount in centimeters (cm) or points (pt) by which the text body should be indented to make up for margin space lost when binding the document.

The div attribute indirectly controls the dimensions of the text body. Its argument is passed through to the LATEX package KOMA-Script which controls the layout of printed documents. KOMA-Script tries to automatically determine the optimal dimensions for the text body according to a set of typographic rules. To this end, it divides the page into div x div rectangles of equal size, which serve as the basic units for splitting the page into margins and text body. The greater you choose div, the bigger the text body will be. Try values between eight and 16.