# [NTG-context] figure directory is sort of searched

Mojca Miklavec mojca.miklavec.lists at gmail.com
Wed Aug 16 19:02:34 CEST 2006

On 8/15/06, Taco Hoekwater wrote:
>
> Hi,
>
> Sanjoy Mahajan wrote:
> > I still can't figure this problem one out, from a few months ago, and it
> > happens with a recent ConTeXt (2006.08.08 21:51).  The figure searching
> > code gets confused if a file of the same basename (but in a different
> > directory) has already been loaded.  Here is a minimal min.tex to show
> > what I mean:
>
> I remember I ran into that as well (more than a year ago) and I ended
> up renaming my figures to figure1-1.pdf etc. It actually turned out
> to be easier for me, because that way I could use the figure filename
> as the reference.

While reading Taco's response something else came to my mind: here's
what I did in one of the presentations:

\startsetups award:gold
\useexternalfigure[medal][medal_gold][height=7.5cm]
\stopsetups

\startsetups award:silver
\useexternalfigure[medal][medal_silver][height=7.5cm]
\stopsetups

\startsetups award:bronze
\useexternalfigure[medal][medal_bronze][height=7.5cm]
\stopsetups

After that I just issued \setups{award:gold} at the top of "product
file" for gold medallists while using the same page layout for all the
medallists (with a simple \externalfigure[medal] which was good for
any medallist).

I guess that you could also do something like

\startsetups chapter:1
\useexternalfigure[fig-1][1/fig-1.pdf]
\useexternalfigure[fig-2][1/fig-2.pdf]
\stopsetups

\startsetups chapter:2
\useexternalfigure[fig-1][2/fig-1.pdf]
...
\stopsetups

\starttext
\setups{chapter:1}
\externalfigure[fig-1]
\externalfigure[fig-2]
\setups{chapter:2}
\externalfigure[fig-1]
\stoptext

Just out of curiosity I tried the following:

\startsetups chapter:1
\dorecurse{10}{\useexternalfigure[fig-\recurselevel][1/fig-\recurselevel.pdf]}
\stopsetups

\startsetups chapter:2
\dorecurse{10}{\useexternalfigure[fig-\recurselevel][2/fig-\recurselevel.pdf]}
\stopsetups

But you should ask someone else where to "expand" stuff to make it work.

Mojca