[NTG-context] XML floating figure and width.
Johannes Graumann
johannes_graumann at web.de
Wed Apr 19 06:24:11 CEST 2006
Hello,
My XML mapping rule for a floating figure looks (thanks to Hans' help) as
follows:
\defineXMLenvironment
[figure]
[width=]
[location=here]
{
\bgroup
\defineXMLsave[caption]
\defineXMLsave[graphic]
}
{
\placefigure
[\XMLpar{figure}{location}{}]
[\XMLpar{figure}{label}{unknown}]
{\XMLflush{caption}}
{\externalfigure[\XMLflush{graphic}][width=\XMLpar{figure}{width}{}}]}
\egroup
}
I want to make it possible to call '\textwidth' from the XML code. '<figure
width="\textwidth">' does not work and does not make much sense when using
the XML with something else but ConTeXt, so I want to implement a mapping
of 'max' to '\textwidth'. I looked up some code Hans gave me for lists and
came up with the following:
\mapXMLvalue {figure:width} {max} {\textwidth}
\defineXMLenvironment
[figure]
[width=]
[location=here]
{
\bgroup
\defineXMLsave[caption]
\defineXMLsave[graphic]
}
{
\placefigure
[\XMLpar{figure}{location}{}]
[\XMLpar{figure}{label}{unknown}]
{\XMLflush{caption}}
{\externalfigure[\XMLflush{graphic}][width=\XMLval{figure:width
{\XMLop{width}}{}]}
\egroup
}
This works great when saying '<figure width="max">', but I loose the
possibility of giving absolute values for 'width' - as in '<figure
width="10cm">'.
Any hints on how to get the 'max' option while retaining compatibility with
absolute values?
Thanks, Joh
More information about the ntg-context
mailing list