[NTG-context] TeX control sequence inside XML param

Hans Hagen pragma at wxs.nl
Fri Jan 28 18:18:52 CET 2005


Vit Zyka wrote:

> I seeee! I might come to me... Actually I'd like to solve a bit more 
> complex task:

some day ...

>          \externalfigure[\filewithpath][\param]}}%

you need to expand the parameters

   \expanded{\external...[...][...]}

food for thought ... (and the wiki)

\starttext

\useMPlibrary[dum]

\defineXMLentity[ctx-var-textwidth] {\textwidth}

\defineXMLenvironmentsave
   [float]
   {\bgroup
    \defineXMLsave[caption]%
    \defineXMLignore[figure]}
   {\XMLflush{float}%
    \defineXMLignore
      [caption]
    \defineXMLcommand
      [figure]
      [file=dummy,context=]
      {\expanded{\externalfigure
        [\XMLflush{dir-fig}\XMLop{file}][\XMLop{context}]}%
       \kern1em
       \ignorespaces}%
    \placefigure
      {\XMLflush{caption}}
      {\hbox{\ignorespaces\XMLflush{float}\removeunwantedspaces}}%
    \egroup}


\startXMLdata
<float>
   <figure file="cow.pdf" context="width=.5&ctx-var-textwidth;" />
   <figure file="hacker.jpg" context="width=3cm" />
   <caption>Cow and hacker.</caption>
</float>
\stopXMLdata

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



More information about the ntg-context mailing list