Greetings! Is it possible to have parts of the ConTeXt file processed conditionally? I'm hoping to be able to do something like: (in ConTeXt file) Question: What is the derivative of $e^{sqrt{x}}$\\ \some-command-start Answer: $\frac{d}{dx} e^{sqrt{x}} ... $ \some-command-end So that, in the command line, if I run "texexec --pdf quiz01.tex" then it will NOT include the answer section, but if I run "texexec --pdf quiz01.tex -some-other-command" it WILL also include the answer section. I'm confident this can be done through an if or if-defined construct. However, I could not find such commands/macros in the ConTeXt manuals (both the beginners and the detailed manual). Thanks in advance, --tk
Lazycode
Is it possible to have parts of the ConTeXt file processed conditionally?
Yes, see the manual (cont-eni.pdf or cont-enp.pdf) and search for \doifmodeelse. That is probably exactly what you need. It is chapter 2.6 "Modes" in "my" manual.
in the ConTeXt manuals (both the beginners and the detailed manual).
it is in the detailed manual. Patrick
Yes, see the manual (cont-eni.pdf or cont-enp.pdf) and search for \doifmodeelse. That is probably exactly what you need. It is chapter 2.6 "Modes" in "my" manual.
I think \startmode[mymode] \stopmode or \startnotmode[mymode] \stopnotmode is better, if fitting. (Compile with "texexec --mode=mymode ...") Grüßlis vom Hraban! -- www.fiee.net/texnique/ www.ramm.ch/context/
On Sunday 19 January 2003 00:06, Lazycode wrote:
Greetings!
Is it possible to have parts of the ConTeXt file processed conditionally? I'm hoping to be able to do something like:
(in ConTeXt file)
Question: What is the derivative of $e^{sqrt{x}}$\\ \some-command-start Answer: $\frac{d}{dx} e^{sqrt{x}} ... $ \some-command-end
So that, in the command line, if I run
"texexec --pdf quiz01.tex" then it will NOT include the answer section, but if I run "texexec --pdf quiz01.tex -some-other-command" it WILL also include the answer section.
I'm confident this can be done through an if or if-defined construct. However, I could not find such commands/macros in the ConTeXt manuals (both the beginners and the detailed manual).
Thanks in advance, --tk _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
In context there is a mode command that handles conditional text. See page 19 of the manual. HTH -- John Culleton Able Indexers and Typesetters Rowse Reviews Culleton Editorial Services http://wexfordpress.com
At 05:06 PM 1/18/2003 -0700, you wrote:
Greetings!
Is it possible to have parts of the ConTeXt file processed conditionally? I'm hoping to be able to do something like:
(in ConTeXt file)
Question: What is the derivative of $e^{sqrt{x}}$\\ \some-command-start Answer: $\frac{d}{dx} e^{sqrt{x}} ... $ \some-command-end
So that, in the command line, if I run
"texexec --pdf quiz01.tex" then it will NOT include the answer section, but if I run "texexec --pdf quiz01.tex -some-other-command" it WILL also include the answer section.
I'm confident this can be done through an if or if-defined construct. However, I could not find such commands/macros in the ConTeXt manuals (both the beginners and the detailed manual).
\defineblock [answer] % \hideblocks[answer] \starttext % \useblocks[answer] question \beginanswer answer \endanswer \stoptext ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
On Mon, Jan 20, 2003 at 10:07:45AM +0100, Hans Hagen wrote:
At 05:06 PM 1/18/2003 -0700, you wrote:
Greetings!
Is it possible to have parts of the ConTeXt file processed conditionally? I'm hoping to be able to do something like:
(in ConTeXt file)
Question: What is the derivative of $e^{sqrt{x}}$\\ \some-command-start Answer: $\frac{d}{dx} e^{sqrt{x}} ... $ \some-command-end
[...]
\defineblock [answer]
Interesting: Three of your users suggest using modes instead. I would have too. What made you choose blocks over modes here? Greetings Johannes -- Johannes Hüsing There is something fascinating about science. One gets hannes@ruhrau.de such wholesale returns of conjecture from such a trifling investment of fact. Mark Twain
At 11:24 PM 1/24/2003 +0100, you wrote:
On Mon, Jan 20, 2003 at 10:07:45AM +0100, Hans Hagen wrote:
At 05:06 PM 1/18/2003 -0700, you wrote:
Greetings!
Is it possible to have parts of the ConTeXt file processed conditionally? I'm hoping to be able to do something like:
(in ConTeXt file)
Question: What is the derivative of $e^{sqrt{x}}$\\ \some-command-start Answer: $\frac{d}{dx} e^{sqrt{x}} ... $ \some-command-end
[...]
\defineblock [answer]
Interesting: Three of your users suggest using modes instead. I would have too.
well, nowadays there is setups as well (more on that in some new styles)
What made you choose blocks over modes here?
(1) no argument grabbing and therefore catcode save, which means that verbatim and so will work (2) they keep track of numbering, so that when you call them up later (say in appendix) you can get similar numbers; say that you want a summary of formula's: put them in blocks, tag them (with optional arg you cna group them in subblocks), then, when you call such a subgroup you get proper numbers; also, refs in such recalled blocks know from which chapter/section/etc they come, so they will be prefixed accordingly (3) hooks and local variables (4) nesting is possible [btw a pretty old mechanism, one of the reasons for context being there] Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
participants (6)
-
Hans Hagen
-
Hraban
-
Johannes Hüsing
-
John Culleton
-
Lazycode
-
Patrick Gundlach