Running ConTeXt

From Wiki
Jump to navigation Jump to search

The First Document page provides a cursory introduction to typesetting document using ConTeXt. The Context page describes the command-line options in brief. This page provides additional information for command-line options.

--run

Process one or more files; this is the default action and may be omitted.

--autopdf

Reopen the generated PDF file in the system's default PDF file viewer after recompiling a document.

--purgeall

Delete all build artifacts generated during compiling of a document, such as .tuc and .log files.

--path=list

Provide a comma-separated list of paths for ConTeXt to search when processing. For example:

context --path="$HOME/writing/common/styles,$HOME/writing/amazing-novel/styles"

--result

Changes the output document file name. ConTeXt creates the output document file in the current working directory; this option cannot create or move the output document in a different directory. Instead, change the working directory before running ConTeXt and use the --path option to configure where ConTeXt searches for files to process.

--errors

ConTeXt is sometimes quite liberal when it comes to non-syntactical errors in the source files. Missing fonts, missing characters in a font, missing references do not automatically abort a run or exit with a non-successful return value. To report possible issues, either compile with --errors or use

\enabledirectives
  [logs.errors]

in the source file. Example:

\starttext
%% missing figure
\externalfigure [nonexistent]
\stoptext

Compiling with context --noconsole --silent --nostatistics file.tex would result in no output (as well as a successful return value). If, on the other hand, compiled with context --noconsole --silent --nostatistics --errors file.tex the output would be:

error logging   > start possible issues
graphics        > start missing figures
graphics        >       foo
graphics        > stop missing figures
error logging   > stop possible issues

The return value would still be zero (success), though. To have the return value reflect possible found issues, patterns can be used. Example:

\enabledirectives
  [logs.errors=*]

Alternatively the patterns can be provided as a compile switch --errors='*'. The quotes are required to prevent shell expansion. With these options, the context would return 1 (failure) if problems are found.

Note that only some of the problems are reported, some of which might not be critical and other, possibly critical problems, are not detected.