Difference between revisions of "Project structure"

From Wiki
Jump to navigation Jump to search
(Updated link to project tool)
(Added some detailed information on compiling components and product files; Fixed the example)
Line 24: Line 24:
  
 
If you tex (compile) one single component (e.g. a chapter of a book) or product (e.g. one volume of a magazine), the environment file of the project is used.
 
If you tex (compile) one single component (e.g. a chapter of a book) or product (e.g. one volume of a magazine), the environment file of the project is used.
 +
 +
In addition, you have to keep in mind that when compiling a product or component file, ConTeXt goes "up" to the project file and compiles everything it finds in there that is not a <cmd>product</cmd> (e.g. table of content, sectioning commands, text, <cmd>component</cmd> etc.). So all the things on project level have to be put inside a <cmd>product</cmd>, otherwise they will show up in the individual components (or products), too. That also makes it problematic to use <cmd>component</cmd> directly inside a project file, i.e. you have to use <cmd>product</cmd>, you can't skip it.
  
 
[[User:Hraban|Hraban]] uses and suggests the following naming conventions
 
[[User:Hraban|Hraban]] uses and suggests the following naming conventions
Line 41: Line 43:
 
\product prd_year2004-04
 
\product prd_year2004-04
  
\completetableofcontents
+
\product tableofcontent
  
 
\stopproject
 
\stopproject

Revision as of 11:15, 24 November 2010

< The ConTeXt Way | Structurals >

ConTeXt knows no document classes (as LaTeX does). You can define your layout yourself. If you use the same layout for several products, save it as an environment file.

How to split up a large project, say a book, in several handy parts? – Use ConTeXt's project management facilities.

  • a project links one or more products to their environment
  • a product contains several components
  • an environment defines the common layout (etc.) of a project

The environment could also contain different versions of the layout, e.g. print and screen (like Pragma's manuals) or final and correction etc.

Example 1: Magazine

  • project: magazine
  • product: one volume of the magazine
  • component: a single article

Example 2: Book

  • project: a series of books
  • product: one book
  • component: part or chapter

Project-structure.png

If you tex (compile) one single component (e.g. a chapter of a book) or product (e.g. one volume of a magazine), the environment file of the project is used.

In addition, you have to keep in mind that when compiling a product or component file, ConTeXt goes "up" to the project file and compiles everything it finds in there that is not a \product (e.g. table of content, sectioning commands, text, \component etc.). So all the things on project level have to be put inside a \product, otherwise they will show up in the individual components (or products), too. That also makes it problematic to use \component directly inside a project file, i.e. you have to use \product, you can't skip it.

Hraban uses and suggests the following naming conventions

  • project_foo
  • prd_foo
  • c_foo
  • env_foo

Project

\startproject project_mymag
\environment env_mymag % only mentioned here!

\product prd_year2004-01
\product prd_year2004-02
\product prd_year2004-03
\product prd_year2004-04

\product tableofcontent

\stopproject

Environment

\startenvironment env_mymag

\setuplayout[...]
% all setups...

\stopenvironment

Product

\startproduct prd_year2004-01
\project project_mymag

\component c_editorial
\component c_article01
\component c_article_by_me
% ...

\stopproduct

Component

\startcomponent c_editorial
\product prd_year2004-01 % but you can use it in other products anyway
\project project_mymag

\title{Editorial}

Dear reader...

\stopcomponent

There's a Python script contextproject.py at Hraban's github repository to help creating the files (.ini files can be used for initial content). This functionality would be nice to be integrated in any editor supporting ConTeXt...