From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
Sanjoy Mahajan <sanjoy@olin.edu>
Subject: Re: hysteresis with content in blocks (one strike and you can be out forever)
Date: Wed, 6 Feb 2019 17:35:16 +0100 [thread overview]
Message-ID: <c53948b5-931b-5a8d-ca4e-5166a4e8a4b9@gmail.com> (raw)
In-Reply-To: <87ftt0q5fg.fsf@olin.edu>
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
___________________________________________________________________________________
next prev parent reply other threads:[~2019-02-06 16:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-06 15:53 Sanjoy Mahajan
2019-02-06 16:35 ` Wolfgang Schuster [this message]
2019-02-06 17:28 ` Sanjoy Mahajan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c53948b5-931b-5a8d-ca4e-5166a4e8a4b9@gmail.com \
--to=wolfgang.schuster.lists@gmail.com \
--cc=ntg-context@ntg.nl \
--cc=sanjoy@olin.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).