ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: components and figure search paths
Date: Wed, 10 May 2006 13:25:27 +0200	[thread overview]
Message-ID: <4461CDA7.2090607@wxs.nl> (raw)
In-Reply-To: <E1Fdeih-0006Uj-4m@approximate.corpus.cam.ac.uk>

Sanjoy Mahajan wrote:
> Using components (e.g. book chapters), with each component in its own
> directory, say I have
>
> \startproduct onebook
> \project manybooks
> \component 1/chap
> \component 2/chap
> \stopproduct
>
> with this 1/chap.tex:
>
> \startcomponent 1/chap
> \product onebook
> \project manybooks
> \title{One}
> An essential chapter.
> \useexternalfigure[ff][abc.1]
> \placefigure[here][ff]{Some caption}{\externalfigure[ff]}
> \stopcomponent
>
> I'd like to keep the figures and source for a chapter together,
> e.g. abc.mp and abc.1 in 1/chap/ since each chapter has many figures,
> and I edit and test one chapter at a time.
>   
untested extension: \currentcomponentpath

\def\currentcomponentpath{.}

\def\donextlevel#1#2#3#4#5#6#7\\%
  {\pushmacro\currentcomponent
   \pushmacro\currentcomponentpath
   \let\currentcomponent#1%
   \setsystemmode\currentcomponent
   \splitfilename{#1}%
   \ifx\splitoffpath\empty
     \def\currentcomponentpath{.}%
   \else
     \let\currentcomponentpath\splitoffpath
   \fi
   \beforesplitstring#7\at.\to#2\relax % can become path + base
   \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\currentcomponentpath
   \popmacro\currentcomponent
   \setsystemmode\currentcomponent
   \ifnum\filelevel=\plusone
     \expandafter\stoptext
   \else
     \decrement\filelevel\relax
     \expandafter\endinput
   \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
-----------------------------------------------------------------

  reply	other threads:[~2006-05-10 11:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-10  2:46 Sanjoy Mahajan
2006-05-10 11:25 ` Hans Hagen [this message]
2006-05-10 12:56   ` Sanjoy Mahajan
2006-05-10 13:31     ` Hans Hagen
2006-05-10 14:17       ` Sanjoy Mahajan
2006-05-10 14:38         ` Hans Hagen
2006-05-10 15:09           ` Sanjoy Mahajan
2006-05-10 15:13           ` David Arnold
2006-05-11  4:29             ` Sanjoy Mahajan
2006-05-11  5:21               ` Aditya 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=4461CDA7.2090607@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /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).