[OS X TeX] path name

Peter Dyballa Peter_Dyballa at Web.DE
Mon Jan 16 15:22:01 CET 2006


Am 16.01.2006 um 12:03 schrieb Friedrich Vosberg:

> ... does not absolut exactly work as I thougt. Because if I have to  
> save a file into a directory containing an ampersand in its name  
> (Procter & Gamble), the command produces an error.
>
> \immediate\write18{pwd | iconv -f UTF-8-MAC -t MacRoman | awk -F'\ 
> \n' '{print "\\newcommand{\\fvpath}{" $1 "\\xspace}"}' > tmppath.tex}
> \immediate\write18{echo "\jobname" | iconv -f UTF-8-MAC -t MacRoman  
> | awk -F'\\n' '{print "\\newcommand{\\fvfile}{" $1 "\\xspace}"}' >  
> tmpfile.tex}


When I invoke in some shell:

	echo "Dies & das" | sed -e 's/&/\\&/g' | awk -F'\n' '{print $1}'

I get

	Dies \& das

Here I change with sed any occurence (that's the final g in sed's  
expression) of & to \&, and for awk I make the newline the valid  
field separator, so that "Dies \& das \& noch etwas mehr" are *one*  
field, as you already know.

Applying this on your examples, assuming your working directory is  
Pröctür & Gämbeł, it might work with:

	\immediate\write18{pwd | sed -e 's/&/\\&/g' | iconv -f UTF-8-MAC -t  
MacRoman ...

Then the file tmppath.tex should contain any & as \&. If \jobname can  
contain & too you would need to invoke

	\immediate\write18{echo "\jobname" | sed -e 's/&/\\&/g' | iconv -f  
UTF-8-MAC -t MacRoman ...


--
Mit friedvollen Grüßen

   Pete

Ein wahrer Pessimist wird durch ein wenig Erfolg nicht gleich entmutigt.


------------------------- 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 Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list