* Head sections automatically marked for conditional text
@ 2017-08-29 21:22 Paul Mazaitis
2017-08-31 12:55 ` Aditya Mahajan
0 siblings, 1 reply; 2+ messages in thread
From: Paul Mazaitis @ 2017-08-29 21:22 UTC (permalink / raw)
To: ntg-context
The short version:
I'd like to set up a context document with multiple user-defined heads,
such that they can be conditionally compiled and/or altered. It seems
that modes are what I want, but I'm having trouble figuring out how to
automatically set up a particular section to be wrapped in a particular
mode (if that makes any sense at all).
Is this possible?
The long version:
What I think I want is something like:
--- begin foo.tex ---
\startenvironment foo
\definemode[showexamples][keep]
% Can I add some magic here in the following setup to automagically
% wrap these sections with commands to start and stop a particular mode?
\definehead[example][subject][style=\bfc]
--- end foo.tex ---
--- begin bar.tex ---
\environment foo
\enablemode[showexamples]
\starttext
\startexample[title={I'd like to be able to use modes to enable or
disable this section}]
I'd like to have a mode to conditionally show all of the {\tt example}
sections (without affecting other content, etc.).
\stopexample
\stoptext
--- end bar.tex ---
The added difficulty here is that I need three kinds of modes (A, B, And
C) with the need to support changing the layout, etc. based on what
modes are enabled.
I've gotten this to work by including \startmode[example] and \stopmode
commands in the document, but I'd love to find a way to have this happen
automatically by some clever setups for user defined heads, as above. (I
tried playing around with before= and after=, with disastrous
results...)
I've worked through the discussion about using blocks against
enumerations, found here:
http://www.mail-archive.com/ntg-context@ntg.nl/msg83818.html
...but I'm hoping that there's a simpler solution (without the external
file, etc.)
Is there a way to do this within the current framework, or should I be
wrapping all of this in new commands? Or something else entirely?
Thanks!
-Paul
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Head sections automatically marked for conditional text
2017-08-29 21:22 Head sections automatically marked for conditional text Paul Mazaitis
@ 2017-08-31 12:55 ` Aditya Mahajan
0 siblings, 0 replies; 2+ messages in thread
From: Aditya Mahajan @ 2017-08-31 12:55 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Tue, 29 Aug 2017, Paul Mazaitis wrote:
>
> The short version:
>
> I'd like to set up a context document with multiple user-defined heads,
> such that they can be conditionally compiled and/or altered. It seems
> that modes are what I want, but I'm having trouble figuring out how to
> automatically set up a particular section to be wrapped in a particular
> mode (if that makes any sense at all).
>
> Is this possible?
Here is how I usually do this:
\definemode[showexamples][keep]
\doifmodeelse{showexamples}
{\definehead[example][subject][style=\bfc]}
{\definebuffer[example]}
\starttext
\input ward
\startexample[title={I'd like to be able to use modes to enable or
disable this section}]
I'd like to have a mode to conditionally show all of the {\tt example}
sections (without affecting other content, etc.).
\stopexample
\stoptext
Aditya
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-31 12:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29 21:22 Head sections automatically marked for conditional text Paul Mazaitis
2017-08-31 12:55 ` Aditya Mahajan
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).