Sanjoy Mahajan schrieb am 06.02.19 um 16:53:
Apologies for the cutesy subtitle. In plainer English, the information
saved in the .tuc file can make it so that a valid ConTeXt file doesn't
compile merely because of what it contained when it was compiled before.
Here is a MIE (minimal illustrative example), on Linux amd64, 2019.01.28 beta:
1. Make the following file:
========== file: testhysteresis.tex ===============
\defineblock[foo]
\starttext
\def\abc{20}
\beginfoo
Use \abc
\endfoo
\useblocks[foo]
\stoptext
========== stop: testhysteresis.tex ===============
2. Compile it with "context --nonstopmode testhysteresis.tex" (which
will work fine).
3. Modify it so that it doesn't define or use \abc (and so that it is
still valid):
========== file: testhysteresis.tex ===============
\defineblock[foo]
\starttext
\beginfoo
Use
\endfoo
\useblocks[foo]
\stoptext
========== stop: testhysteresis.tex ===============
4. Without deleting testhysteresis.tuc, recompile with "context
--nonstopmode testhysteresis.tex". This run fails with the fatal error:
tex error > tex error on line 1 in file virtual://block.foo.1: !
Undefined control sequence
l.1 Use \abc
The cause seems to be that testhysteresis.tuc contains (from the run
it step 2 above):
utilitydata.structures.blocks.collected={
{
["data"]="Use \\abc",
["index"]=1,
["metadata"]=3,
["references"]={
["section"]=0,
},
},
}
5. Delete testhysteresis.tuc.
6. Now "context --nonstopmode testhysteresis.tex" works fine.
One workaround is always to delete the .tuc file before running context.
But that approach seems like overkill (although in my scripts that I use
for running expeirments with blocks etc., I take this approach), and
maybe there is a simpler way.
You can set dimensions with the measure system
%\definemeasure [TestValue] [20pt]
\starttext
\measure{TestValue}
\stoptext
and other values with \setvariables
%\setvariables [test] [abc=20]
\starttext
\getvariable{test}{abc}
\getvariabledefault{test}{abc}{10}
\stoptext
Both systems work even with unset values.
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________