Wolfgang,

Thanks for the suggestion.  However, I'm using ConTeXt to typeset arbitrary XML input from users (and therefore arbitrary image filenames).  While your idea works for the two examples that I gave, it doesn't work if the curly braces aren't balanced in the filename (e.g., "flower{1.jpg").  Is there any general character escaping mechanism for macro arguments?

Cheers,
Mike

-----Original Message-----
From: ntg-context-bounces@ntg.nl on behalf of Wolfgang Schuster
Sent: Thu 12/27/2007 9:00 AM
To: ntg-context@ntg.nl
Subject: Re: [NTG-context] escaping filenames with externalfigure

On Thu, 27 Dec 2007 08:09:55 -0600
"Santy, Michael" <Michael.Santy@dynetics.com> wrote:

> Is there a way to escape special characters in filenames passed to externalfigure.  I'm encountering the situation where users are choosing images that may contain brackets or curly braces (e.g., flower[1].jpg or flower{1}.jpg).  If I pass filename containing these characters directly to externalfigure, the closing bracket is mistaken for the end of the filename.
> \externalfigure[flower{1}.jpg] % works
> \externalfigure[flower[1].jpg] % doesn't work
>
> I then tried to define a variable that holds the filename and pass that variable to externalfigure, but it ran into problems with curly braces.
>
> \def\myimagefilename{flower[1].jpg}
> \externalfigure[\myimagefilename] % works
>
> \def\myimagefilename{flower{1}.jpg}
> \externalfigure[\myimagefilename] % doesn't work
>
> Does anyone have any idea how I could handle arbitrary filename inputs that contain brackets and curly braces?

Yould could define symbolic names for the figures and access the
figures with this name, this allows you also to use bracketrs in the
file names.

\useexternalfigure[brace flower][flower{1}]
\useexternalfigure[bracket flower][{flower[1]}]

\starttext
\externalfigure[brace flower]
\externalfigure[bracket flower]
\stoptext

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________