I'm working on something that really benefits from division into multiple files, and so am trying to figure out the Project/Product/Component structure. I do think I've got most of it working, except for some details in (ab)using the \environment
feature: I'd like some components to use a particular environment, without affecting the rest of the document.
If I just put it at the beginning of the component, it doesn't unload and winds up affecting every component after this one in the product:
\startcomponent c_acronyms
\project proj_ref
\product prd_data
\environment env_list
\startchapter[title=Acronym definitions]
...
\stopchapter
\stopcomponent
I can hack together a solution using \start
and \stop
, but that feels rather ugly as far as hacks go, and any successive invocations of that environment are ignored:
\startcomponent c_acronyms
\project proj_ref
\product prd_data
\startchapter[title=Acronym definitions]
\start
\environment env_list
...
\stop
\stopchapter
\startchapter[title=Keeps default formatting]
\start
\environment env_list
...
\stop
\stopchapter
\stopcomponent
I get the feeling that I'm trying to use \environment
for something it's not actually designed for, but what would the best replacement be for it? I imagine I could do something with modules, but that seems a lot heavier-weight than necessary for such a small collection of commands (especially in my Windows TeXLive installation, which doesn't seem to recognize modules in the project directory). Should I be putting together a specific \definestartstop
?
For reference, here's the minimal contents of the rest of my hiearchy:
\startproduct prd_data
\project proj_ref
\startfrontmatter
\completecontent
\component c_acronyms
\stopfrontmatter
\stopproduct
\startproject proj_ref
\environment env_ref
\product prd_data
\stopproject
\startenvironment env_ref
\usepath[{data}]
\setupcolors[state=start]
\setupinteraction[state=start]
% Add thin spaces before tall punctuation
\definecharacterspacing[thin]
\setupcharacterspacing[thin][\number`:][left=.16667,alternative=1]
\setupcharacterspacing[thin][\number`;][left=.16667,alternative=1]
\setupcharacterspacing[thin][\number`?][left=.16667,alternative=1]
\setupcharacterspacing[thin][\number`!][left=.16667,alternative=1]
\setcharacterspacing[thin]
% Define look-and-feel for the document
\setupalign[hanging]
\setupindenting[yes,small]
\setupwhitespace[medium]
\definefontfeature[default][default][protrusion=quality]
\stopenvironment
\startenvironment env_list
% Override look-and-feel for tabbed lists
\setupindenting[no]
\setupwhitespace[big] % Makes the issue more obvious
\stopenvironment
And while I'm here, does anyone know why compiling the project file doesn't compile each of the products? I'd guess it was originally due to a restriction on one-output-per-invocation, but surely the switch to LuaTeX allows spawning child processes?
product
s have isolated layouts?\input
. You cannot "deinput" the file afterwards. You can only limit the effects by using grouping. Unfortunately, ConTeXt keeps track of environment input globally (one the Lua level) which is why all successive attempts to use the environment are ignored. So the closest you can get to your idea is removing the environment markers from the file and do\start\input env_list ... \stop
.\input
) while that's wondering about use cases.\environment
and\input
that makes the latter sub-optimal: since it doesn't know of the project directory structure, I need to use the full path relative to the component (../env_list
). It definitely works for now, but hardcoding the path like that in an easy macro -- and, admittedly, not doing so is an easy fix -- seems like it's begging to break if I make enough environments to move them to a subfolder or if I nest a component even one level deeper than expected.\setcharacterspacing[frenchpunctuation]
-- not actually documented anywhere on the wiki except the changelogs, but it is talked about on the mailing list (though I found it through the t-french module). The question is updated with what I'm using now, which isn't actually the builtin since I found those spaces a bit thicker than I wanted.