ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Santy, Michael" <Michael.Santy@dynetics.com>
To: "mailing list for ConTeXt users" <ntg-context@ntg.nl>
Subject: Re: escaping filenames with externalfigure
Date: Thu, 27 Dec 2007 09:16:38 -0600	[thread overview]
Message-ID: <6703815B292B664DBAEC55EE3192386A20BD74@poseidon.in.dynetics.com> (raw)
In-Reply-To: <20071227160042.7b85a47f.schuster.wolfgang@googlemail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2463 bytes --]


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
___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 3425 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

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

  reply	other threads:[~2007-12-27 15:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-27 14:09 Santy, Michael
2007-12-27 14:55 ` Hans Hagen
2007-12-27 15:02   ` Santy, Michael
2007-12-27 14:56 ` Hans Hagen
2007-12-27 15:05   ` Santy, Michael
2007-12-27 15:09   ` Wolfgang Schuster
2007-12-27 15:00 ` Wolfgang Schuster
2007-12-27 15:16   ` Santy, Michael [this message]
2007-12-27 15:27     ` Wolfgang Schuster
2007-12-27 15:58       ` Santy, Michael
2007-12-28 23:19         ` Hans Hagen
2008-01-03 13:35           ` Santy, Michael

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6703815B292B664DBAEC55EE3192386A20BD74@poseidon.in.dynetics.com \
    --to=michael.santy@dynetics.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).