externalizing graphics, using same basename

View: New views
3 Messages — Rating Filter:   Alert me  

externalizing graphics, using same basename

by Dan Drake-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I'm trying to use the external graphics features and I've encountered
some strange behavior. I want to have my TikZ snippet in a file called,
say, foo.tex. To make it easy for myself, I want to use that file to
create foo.pdf. So in my main file, I do

  \beginpgfgraphicnamed{foo}
  \input{foo.tex}
  \endpgfgraphicnamed

When I've done "pdflatex --jobname=foo main.tex" everything works fine:
LaTeX finds foo.pdf and includes it. But if I haven't done that, I
expect it to skip the graphics file and do the \input{foo.tex} business
-- but instead, LaTeX complains "File `foo' not found."

If I change the first line above to \beginpgfgraphicnamed{bar}, then
everything works properly, whether or not I've generated the file
bar.pdf.

I'm using PGF version 2.0 with TeXLive 2008, and am trying to adapt Hans
Maine's setup from
http://kogs-www.informatik.uni-hamburg.de/~meine/tikz/process/.

Am I doing something wrong? It would be convenient to be able to use the
same prefix in both places. Thanks!

Dan

--
---  Dan Drake <drake at kaist dot edu>
-----  KAIST Department of Mathematical Sciences
-------  http://mathsci.kaist.ac.kr/~drake


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

signature.asc (204 bytes) Download Attachment

Parent Message unknown Re: externalizing graphics, using same basename

by Christian Feuersaenger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Dan,

I suppose the problem occurs because of the default file suffixes
checked for graphic types - and a funny TeX issue. In details:

The  \beginpgfgraphicnamed{foo} has to check whether a graphics file
'foo' exists, with one of the accepted extensions. If I remember
correctly, the "empty" extension is also part of the default checks.
thus, it is also checked whether "foo" exists. It doesn't, but,
unfortunately, TeX appends the suffix ".tex" *automatically* whenever it
doesn't find a file. So, it finds "foo.tex" and thinks the graphics file
exists - but \includegraphics doesn't accept foo.tex which issues the
error message. At least I think this is the cause.

A solution would be to maintain the basename 'foo', but to append a
*further* suffix like 'foo.code.tex' or something like that. The
graphics file would still be 'foo.pdf'.

A different solution would be to disable the "empty" file extension
check, but that might break compatibility with future versions.

I hope this helps - even though it is not what you might hoped for.

Regards

Christian


--
Christian Feuersaenger
Institut fuer Numerische Simulation
Rheinische Friedrich-Wilhelms Universitaet Bonn
Wegelerstrasse 6
D-53115 Bonn
Germany

Tel:  +49 228 733848
URL:  http://wissrech.ins.uni-bonn.de/people/feuersaenger.html

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: externalizing graphics, using same basename

by Dan Drake-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 27 Aug 2009 at 10:09AM +0200, Christian Feuersaenger wrote:

> I suppose the problem occurs because of the default file suffixes
> checked for graphic types - and a funny TeX issue. In details:
>
> The  \beginpgfgraphicnamed{foo} has to check whether a graphics file
> 'foo' exists, with one of the accepted extensions. If I remember
> correctly, the "empty" extension is also part of the default checks.
> thus, it is also checked whether "foo" exists. It doesn't, but,
> unfortunately, TeX appends the suffix ".tex" *automatically* whenever it
> doesn't find a file. So, it finds "foo.tex" and thinks the graphics file
> exists - but \includegraphics doesn't accept foo.tex which issues the
> error message. At least I think this is the cause.
I suspected that this sort of thing was happening. Thank you for
explaining the details!

> A solution would be to maintain the basename 'foo', but to append a
> *further* suffix like 'foo.code.tex' or something like that. The
> graphics file would still be 'foo.pdf'.
>
> A different solution would be to disable the "empty" file extension
> check, but that might break compatibility with future versions.

I used "-out" for a suffix. In my source file, I have this macro:

\newcommand{\inputtikz}[1]{\beginpgfgraphicnamed{tikz/#1-out}%
\input{tikz/#1.tex}\endpgfgraphicnamed}

which allows me to keep all my externalized graphics in a tikz/
subdirectory. Then, in a Makefile, I have a rule like this:

%-out.pdf: %.tex
    pdflatex --jobname=tikz/$*-out main.tex

The main "make a pdf" rule depends on those %-out.pdf files, and
everything gets built properly -- or I can run "pdflatex main.tex" and
it will work.

It's too bad I can't just use the same base name, but I've worked around
the limitations well enough. Thanks for the quick response.

Dan

--
---  Dan Drake <drake at kaist dot edu>
-----  KAIST Department of Mathematical Sciences
-------  http://mathsci.kaist.ac.kr/~drake


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

signature.asc (204 bytes) Download Attachment