* figure directory is sort of searched
@ 2006-05-20 5:07 Sanjoy Mahajan
2006-05-23 17:21 ` Sanjoy Mahajan
0 siblings, 1 reply; 6+ messages in thread
From: Sanjoy Mahajan @ 2006-05-20 5:07 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 1765 bytes --]
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 (all the files are attached as a .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 <===== The problem??
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.
-Sanjoy
[-- Attachment #2: test files --]
[-- Type: application/x-gtar, Size: 15220 bytes --]
[-- Attachment #3: Type: text/plain, Size: 139 bytes --]
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: figure directory is sort of searched
2006-05-20 5:07 figure directory is sort of searched Sanjoy Mahajan
@ 2006-05-23 17:21 ` Sanjoy Mahajan
0 siblings, 0 replies; 6+ messages in thread
From: Sanjoy Mahajan @ 2006-05-23 17:21 UTC (permalink / raw)
> The figure searching code gets confused if a file of the same
> basename (but in a different directory) has already been loaded.
Looking a bit into this, 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 away :-)
-Sanjoy
`Never underestimate the evil of which men of power are capable.'
--Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
^ permalink raw reply [flat|nested] 6+ messages in thread
* figure directory is sort of searched
@ 2006-08-15 3:50 Sanjoy Mahajan
2006-08-15 8:20 ` Taco Hoekwater
0 siblings, 1 reply; 6+ messages in thread
From: Sanjoy Mahajan @ 2006-08-15 3:50 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 2940 bytes --]
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 #2: example files --]
[-- Type: application/octet-stream, Size: 15220 bytes --]
[-- Attachment #3: Type: text/plain, Size: 139 bytes --]
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: figure directory is sort of searched
2006-08-15 3:50 Sanjoy Mahajan
@ 2006-08-15 8:20 ` Taco Hoekwater
2006-08-15 17:38 ` Sanjoy Mahajan
2006-08-16 17:02 ` Mojca Miklavec
0 siblings, 2 replies; 6+ messages in thread
From: Taco Hoekwater @ 2006-08-15 8:20 UTC (permalink / raw)
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.
Cheers, taco
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: figure directory is sort of searched
2006-08-15 8:20 ` Taco Hoekwater
@ 2006-08-15 17:38 ` Sanjoy Mahajan
2006-08-16 17:02 ` Mojca Miklavec
1 sibling, 0 replies; 6+ messages in thread
From: Sanjoy Mahajan @ 2006-08-15 17:38 UTC (permalink / raw)
Taco sez:
> Sanjoy sez:
> > The figure searching code gets confused if a file of the same
> > basename (but in a different directory) has already been loaded.
> 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.
Good idea, thanks.
I might also integrate the figures (they're all MetaPost) into the
.tex source, what I couldn't do in (e)plain TeX. I expect I'll have a
few questions after I try that :-) The MetaFun manual already told me
the answer to one of them: how to have common settings and macros
across all the MetaPost figures (\startMPinclusions).
-Sanjoy
`Never underestimate the evil of which men of power are capable.'
--Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: figure directory is sort of searched
2006-08-15 8:20 ` Taco Hoekwater
2006-08-15 17:38 ` Sanjoy Mahajan
@ 2006-08-16 17:02 ` Mojca Miklavec
1 sibling, 0 replies; 6+ messages in thread
From: Mojca Miklavec @ 2006-08-16 17:02 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-08-16 17:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-20 5:07 figure directory is sort of searched Sanjoy Mahajan
2006-05-23 17:21 ` Sanjoy Mahajan
2006-08-15 3:50 Sanjoy Mahajan
2006-08-15 8:20 ` Taco Hoekwater
2006-08-15 17:38 ` Sanjoy Mahajan
2006-08-16 17:02 ` Mojca Miklavec
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).