[OS X TeX] failure when using »&« in path names

RA Friedrich Vosberg rafv at me.com
Fri Aug 28 09:28:41 EDT 2009


Morning.

How should I modify the attached below home brewed package to add path  
and file names, so that no failure occurs if a path name contains the  
letter »&«.

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pathfile}[2007/04/19 v0.2.0.0 Friedrich Vosberg]
\RequirePackage{xspace}
% 
%------------------------------------------------------------------------------
\begingroup
	\let\\\relax
	\immediate\write18{%
		pwd | sed -e 's/&/\\&/g' | iconv -f UTF-8-MAC -t MacRoman | awk -F'\ 
\n' '{%
			print"
				\\begingroup
					\\catcode\string^\string^60\\\string^\string^24=11\\relax
					\\catcode\string^\string^60\\\string^\string^26=11\\relax
					\\newcommand\\fvpath{" $1 "\\xspace}\\relax
					\\expandafter
				\\endgroup
				\\expandafter\\newcommand
				\\expandafter\\fvpath
				\\expandafter{\\fvpath}\\relax
				\\endinput"
			}'
		> tmppath.tex%
	}
	\immediate\write18{%
		echo "\jobname" | sed -e 's/&/\\&/g' | iconv -f UTF-8-MAC -t  
MacRoman | awk -F'\\n' '{%
			print"
				\\begingroup
					\\catcode\string^\string^60\\\string^\string^24=11\\relax
					\\catcode\string^\string^60\\\string^\string^26=11\\relax
					\\newcommand\\fvfile{" $1 "\\xspace}\\relax
					\\expandafter
				\\endgroup
				\\expandafter\\newcommand
				\\expandafter\\fvfile
				\\expandafter{\\fvfile}\\relax
				\\endinput"
			}'
		> tmpfile.tex%
	}%
\endgroup
\input{tmppath.tex}
\input{tmpfile.tex}
\newcommand*{\pathfile}[1][pdf]{%
	\frenchspacing\fvpath/\fvfile{}.#1%
}
% 
%= 
= 
= 
= 
= 
= 
========================================================================
% 2006/04/05 v0.1.0.0 initial release
% 2007/04/19 v0.2.0.0 frenchspacing in \newcommand{\pathfile}{} added 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2401 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/macosx-tex/attachments/20090828/f7ba376a/attachment.p7s>


More information about the MacOSX-TeX mailing list