Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using graphicspath for multiple directory levels

2,262 views
Skip to first unread message

car...@colorado.edu

unread,
Apr 28, 2010, 11:32:24 PM4/28/10
to
I am organizing Mac OSX files for a LaTeX book that uses a publisher
class
and the TeXShop front end. Book files (about 600) are to eventually
occupy
three directory levels:
L1. root script, which \input all chapters in sequence
L2. chapter directories: one per chapter, has the chapter script
L3. figure directories, one per chapter, hold all figures (in PDF)
for that chapter
The graphics package is graphicx. I have tried to set up an
overall graphics path, declared in the root script as, say,

\graphicspath{{ch01/ch01figs/}{ch02/ch02figs/} ... }

The graphics package is graphicx. Figures are inserted with
\includegraphics
called from within each chapter. But LaTeX reports that graphics
files
cannot be found. Questions:

(1) Can graphicspath handle multiple directory levels?
(documentation doesnt say; all examples are one-level)
(2) If yes, is the problem caused by including graphics from L2?
(3) If no, should \graphicspath be set on entry to each chapter?

I have previously used graphicspath successfully with TeXShop
with a 2-level organization for several articles, but this is my
first trial with a 3-level one. Thanks.


Enrico Gregorio

unread,
Apr 29, 2010, 4:07:07 AM4/29/10
to
<car...@colorado.edu> wrote:

=== master.tex ===
\documentclass[a4paper]{book}
\usepackage{graphicx}
\graphicspath{{ch01/ch01figs/}{ch02/ch02figs/}}

\begin{document}
\frontmatter
x
\mainmatter
\chapter{Primo}
\input{ch01/primo}

\chapter{Secondo}
\input{ch02/secondo}

\end{document}

=== ch01/primo.tex ===
abc

\includegraphics{logo1}

=== ch01/secondo.tex
abc

\includegraphics{logo2}

=== output of "ls -R" ===
% ls -R
ch01 ch02 master.aux master.log master.pdf master.tex

./ch01:
ch01figs primo.tex

./ch01/ch01figs:
logo1.pdf

./ch02:
ch02figs secondo.tex

./ch02/ch02figs:
logo2.pdf

=== relevant part of the log file (edited to limit line length)
Chapter 1.
(./ch01/primo.tex
<ch01/ch01figs/logo1.pdf, id=6, 190.7125pt x 192.72pt>
<use ch01/ch01figs/logo1.pdf>)
[1 <./ch01/ch01figs/logo1.pdf>]
Chapter 2.
(./ch02/secondo.tex
<ch02/ch02figs/logo2.pdf, id=16, 190.7125pt x 192.72pt>
<use ch02/ch02figs/logo2.pdf>)
[2 <./ch02/ch02figs/logo2.pdf>]
===

So it seems to work.

Ciao
Enrico

car...@colorado.edu

unread,
Apr 29, 2010, 12:54:09 PM4/29/10
to
Many thanks. Was your test done on a Mac under OSX? I am beginning
to suspect
that the behavior of graphicspath for multiple levels is OS
dependent. If that is the
case I will have to put it inside an /if ... \fi since the publisher
might have a different OS.

Thorsten Bonow

unread,
Apr 29, 2010, 1:09:21 PM4/29/10
to
>>>>> "carlos" == carlos <car...@colorado.edu> writes:

carlos> On Apr 29, 2:07 am, Enrico Gregorio <grego...@math.unipd.it> wrote:

[...]

>> >          \graphicspath{{ch01/ch01figs/}{ch02/ch02figs/} ... }

[...]

>> So it seems to work.
>>
>> Ciao Enrico

[...]

carlos> Many thanks. Was your test done on a Mac under OSX? I am
carlos> beginning to suspect
carlos> that the behavior of graphicspath for multiple levels is OS
carlos> dependent. If that is the case I will have to put it inside an /if
carlos> ... \fi since the publisher might have a different OS.

Hi, use something like

\graphicspath{{:eps:}{:tiff:}}

on a Mac.

I'm quoting from "grfguide.pdf":

\graphicspath{ dir-list }

This optional declaration may be used to specify a list of directories in
which to search for graphics files. The format is the same as for the
LaTeX2e primitive \input@path. A list of directories, each in a {} group
(even if there is only one in the list). For example:

\graphicspath{{eps/}{tiff/}} would cause the system to look in the
subdirectories eps and tiff of the current directory. This is unix syntax,
on a Mac it would be:

\graphicspath{{:eps:}{:tiff:}}

Note the differing conventions, an initial : is needed on Macintosh systems
to denote the current folder, whereas on unix an initial / would denote the
top level 'root' directory.

The default setting of this path is \input@path that is: graphics files
will be found wherever TEX files are found.

Hope this helps

Toto

--
I rarely meddled in the cat's personal affairs and she rarely meddled in
mine. Neither of us was foolish enough to attribute human emotions to our
pets. Friedman, Kinky: Greenwich Killing Time

Alan Munn

unread,
Apr 29, 2010, 1:48:21 PM4/29/10
to
In article <87wrvq1...@withouthat.org>,
Thorsten Bonow <thorste...@withouthat.org> wrote:

> Hi, use something like
>
> \graphicspath{{:eps:}{:tiff:}}
>
> on a Mac.
>
> I'm quoting from "grfguide.pdf":
>
> \graphicspath{ dir-list }
>
> This optional declaration may be used to specify a list of directories in
> which to search for graphics files. The format is the same as for the
> LaTeX2e primitive \input@path. A list of directories, each in a {} group
> (even if there is only one in the list). For example:
>
> \graphicspath{{eps/}{tiff/}} would cause the system to look in the
> subdirectories eps and tiff of the current directory. This is unix
> syntax,
> on a Mac it would be:
>
> \graphicspath{{:eps:}{:tiff:}}
>
> Note the differing conventions, an initial : is needed on Macintosh
> systems
> to denote the current folder, whereas on unix an initial / would denote
> the
> top level 'root' directory.

This is seriously outdated. The Mac since OS 10 *is* BSD unix
underlyingly, so it uses / as the directory delimiter. The : delimiter
hasn't been in use for years for most users, and simply doesn't work.

Since you're on a Linux box, I guess you couldn't have known...

Alan

Enrico Gregorio

unread,
Apr 29, 2010, 1:56:23 PM4/29/10
to
<car...@colorado.edu> wrote:

> Many thanks. Was your test done on a Mac under OSX? I am beginning
> to suspect
> that the behavior of graphicspath for multiple levels is OS
> dependent. If that is the
> case I will have to put it inside an /if ... \fi since the publisher
> might have a different OS.

It was on Mac OS X. I don't use Windows, but I believe that
TeX programs on that platform understand directory delimiters just
like on Unix systems. So the only problem would be on Mac OS 9,
and I doubt that publishers still use it.

Ciao
Enrico

0 new messages