ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Typesetting products and components
@ 2005-02-14 20:27 Randall Skelton
  2005-02-15 18:38 ` Peter Münster
  2005-02-15 18:47 ` Hans Hagen
  0 siblings, 2 replies; 4+ messages in thread
From: Randall Skelton @ 2005-02-14 20:27 UTC (permalink / raw)


Is it possible to determine if texexec is being run on a product or a
component and have optional processing similar to different modes?

I have a large project comprising quarterly reports and technical
notes.  Essentially, I have the following structure:

project = MyProject
  |- product = Reports
     |- component1 = year2005, chapters 1-n
     |- component1 = year2006, chapters 1-n
     ...
  |- product = TechNotes
     |- component1 = note1, sections 1-n
     |- component1 = note2, sections 1-n
     ...
  ...

I would like to be able to typeset a component differently depending
on whether it is passed directly to texexec or whether I am processing
the complete product.  For instance, in each technical note, I would
like a title page, table of contents, list of abreviations, and list
of references generated if I typeset the component separately. 
Conversely, when processing the product TechNotes I want a master
table of contents, list of abbreviations and list of references
generated for the set of components.  Is it appropriate to want to do
this or have I misunderstood the role of projects, products and
components entirely.

Cheers,
Randall

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Typesetting products and components
  2005-02-14 20:27 Typesetting products and components Randall Skelton
@ 2005-02-15 18:38 ` Peter Münster
  2005-02-15 18:59   ` Hans Hagen
  2005-02-15 18:47 ` Hans Hagen
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Münster @ 2005-02-15 18:38 UTC (permalink / raw)


On Mon, 14 Feb 2005, Randall Skelton wrote:

> Is it possible to determine if texexec is being run on a product or a
> component and have optional processing similar to different modes?

\ifx\currentproduct\empty
no product defined
\else
the product is \currentproduct
\fi

Cheers, Peter

-- 
http://pmrb.free.fr/contact/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Typesetting products and components
  2005-02-14 20:27 Typesetting products and components Randall Skelton
  2005-02-15 18:38 ` Peter Münster
@ 2005-02-15 18:47 ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2005-02-15 18:47 UTC (permalink / raw)


Randall Skelton wrote:

> generated for the set of components.  Is it appropriate to want to do
> this or have I misunderstood the role of projects, products and
> components entirely.
as long as you understand the logic behind your choices it;s ok

I'll add a system mode: (put this in cont-new.tex)

\startvariables          dutch                     english
                          german                    czech
                          italian                   romanian

             environment: omgeving                  environment
                          umgebung                  prostredi
                          ambiente                  mediu
               component: onderdeel                 component
                          komponente                komponenta
                          componente                componenta
                 product: produkt                   product
                          produkt                   produkt
                          prodotto                  produs
                 project: project                   project
                          projekt                   projekt
                          progetto                  proiect

\stopvariables

\unprotect

\let\currentcomponent\v!text

\def\donextlevel#1#2#3#4#5#6#7\\%
   {\pushmacro\currentcomponent
    \let\currentcomponent#1
    \setsystemmode\currentcomponent
    \beforesplitstring#7\at.\to#2\relax
    \ifcase\filelevel\relax
      \starttext
      \def\project     ##1 {#3{##1}}%
      \def\environment ##1 {#4{##1}}%
      \def\product     ##1 {#5{##1}}%
      \def\component   ##1 {#6{##1}}%
    \fi
    \increment\filelevel\relax
    \fullexpandoneargafter\addtocommalist{#1}\loadedfiles}

\def\doprevlevel
   {\popmacro\currentcomponent
    \setsystemmode\currentcomponent
    \ifnum\filelevel=\plusone
      \expandafter\stoptext
    \else
      \decrement\filelevel\relax
      \expandafter\endinput
    \fi}

\def\startproject #1 %
   {\donextlevel\v!project\currentproject
      \donotexecutefile\doexecutefileonce
      \doexecutefileonce\doexecutefile#1\\}

\def\startproduct #1 %
   {\doateverystarttext
    \donextlevel\v!product\currentproduct
      \doexecutefileonce\doexecutefileonce
      \donotexecutefile\doexecutefile#1\\}

\def\startcomponent #1 %
   {\doateverystarttext
    \donextlevel\v!component\currentcomponent
      \doexecutefileonce\doexecutefileonce
      \donotexecutefile\doexecutefile#1\\}

\def\startenvironment #1 %
   {\donextlevel\v!environment\currentenvironment
      \donotexecutefile\doexecutefileonce
      \donotexecutefile\donotexecutefile#1\\}

\protect

\starttext

% \startproject test

%     1: \startmode[*project] project \stopmode \endgraf
%     2: \startmode[*product] product \stopmode \endgraf

% \stopproject

\startproduct test

1: \startmode[*project] project \stopmode \endgraf
2: \startmode[*product] product \stopmode \endgraf

\stopproduct

\stoptext



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Typesetting products and components
  2005-02-15 18:38 ` Peter Münster
@ 2005-02-15 18:59   ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2005-02-15 18:59 UTC (permalink / raw)


Peter Münster wrote:
> On Mon, 14 Feb 2005, Randall Skelton wrote:
> 
> 
>>Is it possible to determine if texexec is being run on a product or a
>>component and have optional processing similar to different modes?
> 
> 
> \ifx\currentproduct\empty
> no product defined
> \else
> the product is \currentproduct
> \fi

ah, that's indeed an option,

\doifelsenothing\currentproduct
   {no product defined}
   {the product is \currentproduct}

is a bit more robust (esp if currentproduct is something {bla\macro bla}

in that case, a quite readable approach is:

\startsetups todo:product:nop

   ....

\stopsetups

\startsetups todo:product:yes

   ....

\stopsetups

\doifelsenothing\currentproduct
   {\setups[todo:product:nop]}
   {\setups[todo:product:yes]}

or as variant on your ifx, a one-liner:

\setups[todo:product:\ifx\currentproduct\empty nop\else yes\fi]



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-02-15 18:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-14 20:27 Typesetting products and components Randall Skelton
2005-02-15 18:38 ` Peter Münster
2005-02-15 18:59   ` Hans Hagen
2005-02-15 18:47 ` Hans Hagen

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).