Looking to understand the definitive relationship between projects, products, environments, and components.

Minimum Working Example

Here's the directory structure showing the problem:

├── project/novel
│   ├── project/novel/component.tex
│   ├── project/novel/contents.tex
│   ├── project/novel/prd_para.tex
│   └── project/novel/product.tex
├── project/prj_para.tex
└── project/project.tex


\startproject project
  \environment prj_para

  \product product


\startenvironment prj_para
  \define\bookname{Project Name}


% Does not override \bookname from prj_para.tex?
\startenvironment prd_para
  \define\bookname{Product Name}


\startcomponent component
  \project project


  \input contents


Pride and Prejudice

Jane Austen


It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife.


  \project project

  \environment prd_para

  \component component


The project is built from within the project directory:

context novel/product --path=novel 


The following setup is what I'd like to achieve:

Project Structure

Every product "inherits" its environment settings from a global project. Each product can override specific settings. For example, the project could define Arial as the base font for all products, but one product could redefine it as Helvetica.


Ideally, the setups in the project-level prj_para.tex (i.e., "project-wide" as per the project structure diagram) could be changed in the product-level prd_para.tex.

However, the value for \bookname is always Project Name, rather than Product Name. Here is how the output appears:

Example Output


Using environments, projects, products, and components, how can setups in the project-wide environments be changed by the product-specific environments?

In short, how can "Product Name" be output instead?


Various documentation sources seem to contradict each other, for example startcomponent shows:

\startcomponent *
   \project projectname

While Project structure shows:

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

Neither Magazine #1101, July 2011 nor Magazine #1101, September 2016 explicitly state how \startcomponent/\stopcomponent is codified in relation to either projects or products.

The mailing list has numerous questions with specific answers, but nothing broad in scope. A Python Script generates files and directories, but without understanding how those files and directories relate, it offers little insight.

The wiki states:

  • 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

In addition, there are numerous answers on TeX.SE, but few show a tree with all files and directories:

  • 2
    Repeating an earlier comment of mine: “projects are essentially collections of environments” Commented Apr 19, 2020 at 1:38
  • The beginner's manual should meet most of your requirements. github.com/contextgarden/context-mirror/tree/beta/doc/context/… Commented Apr 19, 2020 at 4:17
  • Oh, and just to clarify my previous comment: You don't “compile the entire project”. You always compile the individual products. I don't think compiling project files is even supported or implemented. Commented Apr 19, 2020 at 4:19
  • FWIW, I always use only components and environments. To get a "collection of environments" I simply contain a main environment which calls other environments.
    – Aditya
    Commented Apr 19, 2020 at 5:32
  • 1
    You're missing the name after \startproduct which results in the wrong output. I suggest to also use the \input in you component file and move either the content in this file or make the content itself in a component (components can be nested). Commented Apr 19, 2020 at 19:44

1 Answer 1


The following works as expected using the given directory hierarchy:

% File: prj_para.tex
\startenvironment *

  \define\bookname{Project Name}

% File: prd_para.tex
\startenvironment *

  \define\bookname{Product Name}

% File: component.tex
\startcomponent *
  \project project


  \component contents

% File: product.tex (note that * was missing)
\startproduct *
  \project project

  \environment prd_para

  \component component

This produces:

Output, not grid-aligned

If we remove the \setuplayout from prd_para.tex, the output changes to grid-aligned typesetting:

Output, grid-aligned

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .