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:

\starttext
\setupexternalfigures[directory={1}]
\placefigure[here][ch1fig]{should be 1/fig-1.pdf}{\externalfigure[fig-1.pdf]}
\setupexternalfigures[directory={2}]
\placefigure[here][ch2fig1]{should be 2/fig-1.pdf}{\externalfigure[fig-1.pdf]}
\placefigure[here][ch2fig2]{should be 2/fig-2.pdf}{\externalfigure[fig-2.pdf]}
\stoptext

Probably it's a silly idea to use \setupexternalfigures within the body,
but the same problem happens when using components (where each
component's preamble has a similar line), where it makes more sense.

Here is the directory structure, and all the files are attached as a
small (15KB) .tgz:

min.tex
1/fig-1.pdf
2/fig-1.pdf
2/fig-2.pdf

The final (third) figure is correctly found as 2/fig-2.pdf.  But the
second figure is reused from 1/fig-1.pdf because another fig-1.pdf has
already been found: as 1/fig-1.pdf.  Here is the relevant bit from the
texexec output:

   <./1/fig-1.pdf>
  figures         : dimensions of 1/fig-1.pdf loaded from figurefile itself
  (./min.tuo) (/home/sanjoy/texmf/tex/context/base/pdfr-ec.tex)
  floatblocks     : 1 placed
  figures         : figureobject fig-1.pdf is reused
  floatblocks     : 2 placed
   <./2/fig-2.pdf>
  figures         : dimensions of 2/fig-2.pdf loaded from figurefile itself
  floatblocks     : 3 placed

One part of ConTeXt does know the right figure path.  A
\getfiguredimensions[fig-1.pdf] after the second \placefigure will
trigger a kpathsea search for 2/fig-1.pdf, which it finds.  But it still
loads 1/fig-1.pdf, which is why I've said 'sort of searched' in the
subject line.

It seems that the decision about whether a figure is already loaded is
made in core-fig.tex, in

\def\calculateexternalfigure[#1][#2][#3][#4][#5][#6]%
...
   \ifcase\figurestatus
     \let\@@efframe\v!on
     \let\@@efobject\v!no
     \showmessage\m!figures1\@@effilename
   \or
     \showmessage\m!figures2\@@effullname
   \or
     \showmessage\m!figures3{\@@effullname,\@@eflenttype}%
   \or
     \showmessage\m!figures4\@@effullname
   \or
     \showmessage\m!figures5{\@@effullname,\@@efloadname}%
   \or % no message
     \doifnot\@@efsymbol\v!yes{\showmessage\m!figures8\@@effullname}%
   \fi
...

The "no message" comment suggests that when \figurestatus isn't set,
the message shown is figures8, which is

         8: figureobject -- is reused

But I couldn't figure out who sets \figurestatus and where the judgement
of 'already loaded' is made.  The comment at the beginning of the above
\def ("this whole mess needs a clean up anyway") scared me off :-)

-Sanjoy

`A society of sheep must in time beget a government of wolves.'
   - Bertrand de Jouvenal

Attachment: searching.tgz
Description: example files

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to