hysteresis with content in blocks (one strike and you can be out forever)
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. Best, -Sanjoy
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
You can set dimensions with the measure system
%\definemeasure [TestValue] [20pt]
\starttext \measure{TestValue} \stoptext
and other values with \setvariables
%\setvariables [test] [abc=20]
Probably the .tuc hystersis can jump up and bite one in the rear end in other ways. But \definemeasure and \setvariables do solve the issue in my example. They were also new to me and should prove useful for my style files. (The amount of ConTeXt still to learn is very large...) -Sanjoy
participants (2)
-
Sanjoy Mahajan
-
Wolfgang Schuster