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