generating pdf figures with pdflatex does not work (2.2.0 and latest version)

13 views
Skip to first unread message

thi

unread,
Mar 1, 2012, 6:32:15 AM3/1/12
to latex-makef...@googlegroups.com
Hello,

I have the following rule in my Targets.ini file

figures/%.pdf: figures/tikz/%.tex
@echo generating tikz pic $@
@cd figures && ./gentikzpdf.sh tikz/$(shell basename $<) > /dev/null 2>&1;

When I include a fig in my latex sources with \includegraphics{figures/foobar.pdf} my makefile rule in Targets.ini doesn't get triggerd (although figures/tikz/foobar.tex exists) and the Makefile outputs:

./content/oned_eelc.tex:41: Package pdftex.def Error: File `figures/foobar.pdf' not found.

My setup worked with latex instead of pdflatex and a pre 2.2.0 Makefile.

Any hints what went wrong ?

Regards
Thomas

Chris Monson

unread,
Mar 2, 2012, 9:40:51 AM3/2/12
to latex-makef...@googlegroups.com
This is one of those vagaries of "make" that can trip people up.  The syntax that you used for targets, namely:

figures/%.pdf: figures/tikz/%.tex

is not supported, so far as I can tell.  % has to match the entire file prefix, nothing less on the right side.  So, unless your tikz files are *also* in figures/, you're out of luck.

That's my very quick initial assessment of the situation, anyway.

Also, you should be aware that the makefile has never worked well with figure subdirectories, and that there are no plans to enhance it in that way.
 

Regards
Thomas


Thomas Hisch

unread,
Mar 2, 2012, 1:18:47 PM3/2/12
to latex-makef...@googlegroups.com
On Fri, Mar 2, 2012 at 3:40 PM, Chris Monson <shi...@gmail.com> wrote:
>
>
> On Thu, Mar 1, 2012 at 12:32 PM, thi <t.h...@gmail.com> wrote:
>>
>> Hello,
>>
>> I have the following rule in my Targets.ini file
>>
>> figures/%.pdf: figures/tikz/%.tex
>> @echo generating tikz pic $@
>> @cd figures && ./gentikzpdf.sh tikz/$(shell basename $<) > /dev/null 2>&1;
>>
>> When I include a fig in my latex sources with
>> \includegraphics{figures/foobar.pdf} my makefile rule in Targets.ini doesn't
>> get triggerd (although figures/tikz/foobar.tex exists) and the Makefile
>> outputs:
>>
>> ./content/oned_eelc.tex:41: Package pdftex.def Error: File
>> `figures/foobar.pdf' not found.
>>
>> My setup worked with latex instead of pdflatex and a pre 2.2.0 Makefile.
>>
>> Any hints what went wrong ?
>
>
> This is one of those vagaries of "make" that can trip people up.  The syntax
> that you used for targets, namely:
>
> figures/%.pdf: figures/tikz/%.tex
>
> is not supported, so far as I can tell.  % has to match the entire file
> prefix, nothing less on the right side.  So, unless your tikz files are
> *also* in figures/, you're out of luck.

I changed the make rule to
figures/tikz/%.pdf: figures/tikz/%.tex

and now everything works.

Thx!

Thomas Hisch

unread,
Mar 2, 2012, 3:16:44 PM3/2/12
to latex-makef...@googlegroups.com
No it doesn't work, at least not with pdflatex (with latex and
figures/tikz/%.eps: figures/tikz/%.tex it works).

The problem is simple:

with pdflatex the following simple rule (in Targets.ini) does not get
triggered ( my abc.tex files includes
\includegraphics{figures/tikz/foobar.pdf})

figures/tikz/%.pdf: figures/tikz/%.tex
@echo MY generating tikz pic $@

make outputs

./abc.tex:41: Package pdftex.def Error: File `figures/tikz/foobar.pdf'
not found.

is there any possibility to fix this ?

Chris Monson

unread,
Mar 7, 2012, 5:20:22 AM3/7/12
to latex-makef...@googlegroups.com
No, not that I'm aware.  As I mentioned earlier, the make rule is not well-formed, and you can't really do exactly what you want to here.

You can specify extra source directories to make, and it will search in them to find your files, but this doesn't work properly with tex.  I deliberated a long time about this when I wrote the (second version of) the makefile, but no good solution presented itself.  Either you get automatic builds, or you try to have things in subdirectories.  You can't have both.

I know it's annoying, but to be completely honest, I've never needed subdirectories, even for extremely large documents (like my dissertation) with lots of graphics.  The fact that "make clean" works well makes it less important to keep everything separate, in my experience.

So, the workaround is to put your graphics in the same directory as your source file.  It's also the only supported way of doing it with this makefile.  Someday I keep thinking that I'll rewrite the whole thing as a single Python file that you can just drop in your directory, and that would probably support graphics in subdirectories, but that day is almost certainly a long way off.  :-)
Reply all
Reply to author
Forward
0 new messages