[OS X TeX] Strange differences between paths in \include, \input and \includegraphics

Ramón M. Figueroa-Centeno ramonf at hawaii.edu
Sat Mar 14 08:46:15 CET 2009


I am trying to learn what are the limits to the allowable file paths that
can be passed to \input, \include and \includegraphics. I found two sets of
differences between the three (in both pdftex and tex+dvi):

1. When dealing with files with spaces in their names input simply requires
the path to be in quotations, for example, \input{"Section 1/section one"}.
Now, \include requires the spaces to be "escaped" with a \space command, for
example, \include{"Section\space 2/section\space two"}. Finally, the file
paths, but not the extensions must be in quotations for \includegraphics,
for example, \includegraphics{"../Plot 2".pdf} for the file "Plot 2.pdf".

See, <http://wiki.lyx.org/LaTeX/FilesWithSpecialChars> for a comprehensive
analysis of what silly file names are possible :)

2. (This is the annoying one) A path to a file in a directory outside the
one where the main document resides works for \input and \includegraphics,
but not for \include. For example, \input{../section-five} works, whereas
\include{../section-five} does not. Indeed, with the latter, LaTeX chokes,
saying that "! I can't write on file `../section-five.aux'."

Is this by design? If so why? Is there a workaround?

I am planning to write a script (or scripts) for TeXShop that allows the
user to insert "inputs" and "includes" via a file dialog. So I need to
understand how they work in regard to where files they point to are located.
For \include I do not want to (needlessly?) constrain the user to files that
are only in the main document's directory or sub-directories thereof.

Finally, in my experiments with TeXShop, it seems that stuff like:

% !TEX root = ../Root Document.tex


% !TEX root = Root Test/Root Document.tex

are OK, that is, spaces in the file names and files in arbitrary directories
work fine. Right?




Ramón M. Figueroa-Centeno, Ph.D.
Associate Professor

Mathematics Department
University of Hawaii at Hilo
College Hall 4-A
200 W. Kawili St.
Hilo, HI 96720-4091

(808) 974-7387 (office)
(808) 933-3473 (fax)


PGP/GnuPG Public Key at http://www2.hawaii.edu/~ramonf/ramonf.gpgkey

More information about the macostex-archives mailing list