Re: [NTG-context] Extract only certain part of document (via modes)?

2016-11-10 Thread Wolfgang Schuster

Hans Hagen 
10. November 2016 um 17:27


search for 'blocks' ...

\defineblock
...
\hideblocks
\keepblocks
\useblocks
\processblocks
\selectblocks

This doesn’t solve the problem because he want a document which
contains *only* certain blocks and nothing else, a solution for this
is a commands (\saveblocks) which saves the content of a block
in a external file (like \savebuffer does).

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
___

Re: [NTG-context] Extract only certain part of document (via modes)?

2016-11-10 Thread Hans Hagen

On 11/6/2016 12:51 PM, Mikael P. Sundqvist wrote:

Dear list, and in particular Hans,

I asked the same question on stackexchange before today
(http://tex.stackexchange.com/q/337738/52406), and got the answer that
what I want to do might not be possible.

In my large document I have exercises (typeset with \startexercise
\stopexercise, defined as an enumeration). Is it possible to use modes
(or any other trick) to be able to compile the same file and get only
the exercises. For example,

context file.tex

should give the full document, while

context --mode=exercises file.tex

should give only all the exercises (or just everything "in one mode")?


search for 'blocks' ...

\defineblock
...
\hideblocks
\keepblocks
\useblocks
\processblocks
\selectblocks

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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
___

Re: [NTG-context] Extract only certain part of document (via modes)?

2016-11-06 Thread Mikael P. Sundqvist
On Sun, Nov 6, 2016 at 3:03 PM, Wolfgang Schuster
 wrote:
> Mikael P. Sundqvist
> 6. November 2016 um 12:51
> Dear list, and in particular Hans,
>
> I asked the same question on stackexchange before today
> (http://tex.stackexchange.com/q/337738/52406), and got the answer that
> what I want to do might not be possible.
>
> In my large document I have exercises (typeset with \startexercise
> \stopexercise, defined as an enumeration). Is it possible to use modes
> (or any other trick) to be able to compile the same file and get only
> the exercises. For example,
>
> context file.tex
>
> should give the full document, while
>
> context --mode=exercises file.tex
>
> should give only all the exercises (or just everything "in one mode")?
>
> You can put each exercise in a block and ask Hans to add a \saveblocks
> commands
> which writes the content of all exercise blocks to a external file (like
> \savebuffer lets
> you save the content of a buffer in a external file).
>
>
> \defineblock[exercise]
> \keepblocks [exercise]
>
> \defineenumeration[exercise][text=Exercise]
>
> %\doifmode{exercises}{\saveblocks[exercise][exercises.tex]}
>
> \starttext
>
> \beginexercise
> \startexercise
> This is the first exercise.
> \stopexercise
> \endexercise
>
> \beginexercise
> \startexercise
> This is the second exercise.
> \stopexercise
> \endexercise
>
> \stoptext
>
>
> The content of this saved file can then be read by another file
> to get a document which contains only the exercises.
>
>
> \defineenumeration[exercise][text=Exercise]
>
> \starttext
>
> \doiffileelse{exercise}
>   {\input{exercises}}
>   {{\tttf Exercise file doesn’t exist.}}
>
> \stoptext
>
>
> 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
> ___

Thank you for the answer, I think that would be nice to have. Hans, do
you mind adding such a feature? Or do you have any other idea on the
problem as is?

/Mikael
___
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
___

Re: [NTG-context] Extract only certain part of document (via modes)?

2016-11-06 Thread Wolfgang Schuster

Mikael P. Sundqvist 
6. November 2016 um 12:51
Dear list, and in particular Hans,

I asked the same question on stackexchange before today
(http://tex.stackexchange.com/q/337738/52406), and got the answer that
what I want to do might not be possible.

In my large document I have exercises (typeset with \startexercise
\stopexercise, defined as an enumeration). Is it possible to use modes
(or any other trick) to be able to compile the same file and get only
the exercises. For example,

context file.tex

should give the full document, while

context --mode=exercises file.tex

should give only all the exercises (or just everything "in one mode")?
You can put each exercise in a block and ask Hans to add a \saveblocks 
commands
which writes the content of all exercise blocks to a external file (like 
\savebuffer lets

you save the content of a buffer in a external file).


\defineblock[exercise]
\keepblocks [exercise]

\defineenumeration[exercise][text=Exercise]

%\doifmode{exercises}{\saveblocks[exercise][exercises.tex]}

\starttext

\beginexercise
\startexercise
This is the first exercise.
\stopexercise
\endexercise

\beginexercise
\startexercise
This is the second exercise.
\stopexercise
\endexercise

\stoptext


The content of this saved file can then be read by another file
to get a document which contains only the exercises.


\defineenumeration[exercise][text=Exercise]

\starttext

\doiffileelse{exercise}
  {\input{exercises}}
  {{\tttf Exercise file doesn’t exist.}}

\stoptext


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
___

[NTG-context] Extract only certain part of document (via modes)?

2016-11-06 Thread Mikael P. Sundqvist
Dear list, and in particular Hans,

I asked the same question on stackexchange before today
(http://tex.stackexchange.com/q/337738/52406), and got the answer that
what I want to do might not be possible.

In my large document I have exercises (typeset with \startexercise
\stopexercise, defined as an enumeration). Is it possible to use modes
(or any other trick) to be able to compile the same file and get only
the exercises. For example,

context file.tex

should give the full document, while

context --mode=exercises file.tex

should give only all the exercises (or just everything "in one mode")?

/Mikael
___
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
___