[NTG-context] referring to floats in xml

Aditya Mahajan adityam at umich.edu
Sun Mar 20 17:05:24 CET 2011


On Sun, 20 Mar 2011, R. Ermers wrote:

> Dear All,
>
> My xml docbook file contains a number of graphics. Some are regular 
> figures, some are edgefigures. I have two questions in this respect.

Understanding these snippets is difficult without a minimal working 
example.

> A. referring to floats
>
> \placeedgefigure
> [\xmlatt{#1}{id}]
> {\xmlfirst{#1}{/caption}}
> {\framed[frame=off]{\setlayer[graphics]{\xmlfirst{#1}{/imageobject}}}}
>
> \definefloat[edgefigure][figure]
> \setupfloat[edgefigure]
> [leftmargindistance=-\innercombitotal,rightmargindistance=-\outercombitotal,
> default={outer,low,long}, criterium=.65\textwidth,numbering=no]
>
> <mediaobject id="fig:cow" role="edgefigure">
>          <imageobject>
>            <imagedata scale="500" fileref="cow.jpg"/>
>          </imageobject>
>        </mediaobject>
>
> I now wonder how to refer to these floats. That is, referring through <xref linkend="cow"/> is not difficult to implement, but for some reason the mapping of the id is not that obvious. I tried it like this:
>
> \startxmlsetups xml:mediaobject:edgefigure
> \placeedgefigure
> [\xmlatt{#1}{id}]
> {\xmlfirst{#1}{/caption}}
> {\framed[frame=off]{\setlayer[graphics]{\xmlfirst{#1}{/imageobject}}}}
> \stopxmlsetups


Try

\placeedgefigure
   []
   [\xmlatt{#1}{id}]
   {....}
   {....}
> B. edgefigures and regular figures
>
> The document contains two types of figures.
>
> \xmlsetsetup{#1}{mediaobject[@role='fig']}{xml:mediaobject:fig}
> \xmlsetsetup{#1}{mediaobject[@role='edgefigure']}{xml:mediaobject:edgefigure}
>
> I have noticed that when <mediaobject> contains both the attributes id 
> and role, such as the cow example, the figure is considered a regular 
> figure automatically and will not typeset as an edgefigure.

Please provide a minimal working example.

Aditya


More information about the ntg-context mailing list