[tex-k] About spaces in file names

Heiko Oberdiek oberdiek at uni-freiburg.de
Sat Apr 23 12:45:30 CEST 2005


On Fri, Apr 22, 2005 at 05:41:07PM +0200, Olaf Weber wrote:

> Heiko Oberdiek writes:
> 
> > Afaik Olaf did somethink regarding TeX. Spaces are supported by
> > using quotes. However, the problem are now the quotes :-(
> 
> > Therefore I would appreciate an interface with explicit curly
> > braces with catcodes 1 and 2, so that all bytes (0-255) can
> > be expressed inside (example, see below).
> 
> Right now, if you use (plain) TeX and do
> 
>  \input{story}
> 
> the file being looked for will be "{story}.tex"; do
> 
>  \input{sto ry}
> 
> and TeX will look for "{sto.tex".  It would be possible to get TeX to
> interpret these braces.
> 
> For LaTeX's |\input| macro I presume you'd not want to add the braces
> twice:
> 
>  \input{{sto ry}}
> 
> and instead use
> 
>  \input{sto ry}
> 
> Doing this without getting LaTeX to add additional braces before
> feeding the filename to the |\input| or |\openin| primitive turns out
> to be hard: the filename scanner is not in a good position to tell
> whether it is scanning normal text (where it would interpret braces
> and in their absence stop at the first space) or (say) a macro
> argument (where might want to scan to the end of the argument even in
> the presence of spaces); cases like \input #1.sty turn out to be
> "interesting" to handle.  When I last looked at this I couldn't get
> this completely right, so fell back on the rather primitive hack we
> have today.

Probably it is too dangerous to change the behaviour of the
primitive \input because of compatibility.

Without having looked into the source code, two ideas:
Example file name: Funny "}file{" name.tex

a) Additional primitives (e-TeX?):
  \einput{<token list>}
  \eopenin<stream>{<token list>}
  \eopenout<stream>{<token list>}

  Eg: \einput{Funny "\string}file\string{" name.tex}

b) Encoding of file names:

  \input @base64 at RnVubnkgIn1maWxleyIgbmFtZS50ZXg=@
  or
  \input @quoted-printable at Funny=20=22=7Dfile=7B=22=20name.tex

  If the file name contains the markers "@<encoding>@...@", then
  the stuff "..." is decoded and contains the file
  name: Funny "file" name.tex

In both cases the extension of the file names must be given to
avoid problems with file names without extension.

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>
-- 



More information about the tex-k mailing list