[OS X TeX] Spaces in file or folder names
Peter Dyballa
Peter_Dyballa at Web.DE
Thu Feb 10 08:19:51 EST 2005
Am 10.02.2005 um 12:11 schrieb Denis Chabot:
> By the way, I tried only putting aliases in the Figures folder inside
> the folder of a LaTeX document, but that did not work. I know
> "symbolic links" have slightly different properties than aliases, but
> I never explored that. Would they be a solution?
You could use these two Bourne shell scripts to create symbolic links
in the working directory pointing to files with up to many spaces in
their names, but the link names would have them substituted by
underscores.
#!/bin/sh
# -*- mode: Shell-script; coding: iso-8859-15; -*-
# @(#) despace.sh Time-stamp: <2005-02-10 13:34:04 root>
#
# Find graphics files in the specified directory of the
# specified kind (file extension) and create a symbolic
# link to each that does not contain spaces in its name
#
#echo $#
if test $# -eq 0 ; then
echo "$0 <directory with files of> <extension(s)>"
exit 1
fi
#
Ort="$1"
shift
Art="$*"
Arten=`echo $Art | sed -e 's/ / -o -name */g'`
#echo -n "$Art -> "
#echo "$Arten"
#echo "find $Ort -type f \( -name *$Arten \) -exec link {} \;"
find "$Ort" -type f \( -name *$Arten \) -exec link.sh {} \;
#!/bin/sh
# -*- mode: Shell-script; coding: iso-8859-15; -*-
# @(#) link.sh Time-stamp: <2005-02-10 13:29:34 pete>
#
# Create a symbolic link to this file substituting all
# spaces in its name by underscores
#
Name=`echo $1 | tr ' ' _`
Alias=`basename $Name`
#echo "ln -s $1 $Alias"
ln -s "$1" $Alias
If you put them into your bin directory and make them executable (chmod
755 <name(s)>) you could change in a shell into the directory with the
LaTeX source files and invoke despace.sh:
despace.sh <directory with graphics files> <their extension(s)>
i.e. despace.sh "~/Library/texmf/My really big TeX Projects/Trial&Error
No.4/My *VERY* Colourful Diagramms from Graphics Programme" jpg jpeg
tif
Once the symbolic links are created you can use them in the LaTeX
sources to access the graphics files.
Well, "Trial&Error No.4" could be a bad name because of the "&" ...
might need a \! * too! If you do not write the name to the graphics
sources yourself, but let your shell expand the path name or you drop a
folder from Finder on Terminal the double quotes are not needed. And
special characters are escaped by default then. Shell processing might
be disturbed though ...
--
Greetings
Pete (:
_ / __ - -
_/ \__/_/ - -
(´`) (´`) - -
`´ `´
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
More information about the MacOSX-TeX
mailing list