[XeTeX] spaces in filenames

William Adams will.adams at frycomm.com
Thu Aug 10 14:49:27 CEST 2006

On Aug 10, 2006, at 6:04 AM, Jonathan Kew wrote:

> I have just re-written the filename quoting code, and I think it
> works better now (and is more compatible with pdftex etc). If you
> check out and build the latest pre-0.995 code (rev 324 in
> Subversion), you should be able to handle names with spaces, without
> the .aux file problems (etc) that you've seen.

Wonderful! svn update xetex done, and ./build-xetex compiling now ;)

> For your particular usage, there's one "gotcha" to watch out for: if
> the filename includes spaces, \jobname will return a quoted string.
> But fontspec's \setFOOfont{} macros want the name without quotes. So
> you'll need to strip quote marks from the \jobname string before
> using it in this context. Something like this should work, I think:
>    \makeatletter
>    \def\unquote at Jobname#1"#2"#3\end{\def\Jobname{#1}%
>      \ifx\Jobname\empty\def\Jobname{#2}\fi}
>    \expandafter\unquote at Jobname\jobname""\end
>    \makeatother
>    \setromanfont{\Jobname} % \Jobname is \jobname with quotes (if
> any) stripped

I will try it out. Thanks!

> Strictly speaking, this is not always adequate: if the filename
> *includes* a double-quote character, then \jobname will return a
> single-quoted string instead; and there are even more complex/messy
> possibilities, if the name includes both types of quote marks. But
> for practical purposes, this will probably serve.
> Ever considered how to handle a file named <Joyce's "Ulysses".tex>?!
> XeTeX can now do it:
>    $ xetex Joyce\'s\ \"Ulysses\".tex
>    This is XeTeX, Version 3.141592-2.2-0.995 (Web2C 7.5.5)
>    entering extended mode
>    (./Joyce's "Ulysses".tex [1] )
>    Output written on Joyce's "Ulysses".pdf (1 page).
>    Transcript written on Joyce's "Ulysses".log.
> pdfTeX can't handle this case:
>    $ pdftex Joyce\'s\ \"Ulysses\".tex
>    This is pdfeTeX, Version 3.141592-1.30.4-2.2 (Web2C 7.5.5)
>    entering extended mode
>    ! I can't find file `"Joyce's Ulysses.tex"'.
>    <*> "Joyce's Ulysses.tex"
>    Please type another input file name: ^D
>    ! Emergency stop.
> (Running in a directory where the file *does* exist, of course.)

Above and beyond the call! _That_ is just too cool (and my wife who's  
got a master's in British literature will get a kick out of it too  



William Adams
senior graphic designer
Fry Communications

This email message and any files transmitted with it contain information
which is confidential and intended only for the addressee(s). If you are
not the intended recipient(s), any usage,  dissemination, disclosure, or
action taken in  reliance on it is prohibited.  The reliability of  this
method of communication cannot be guaranteed.  Email can be intercepted,
corrupted, delayed, incompletely transmitted, virus-laden,  or otherwise
affected during transmission. Reasonable steps have been taken to reduce
the risk of viruses, but we cannot accept liability for damage sustained
as a result of this message. If you have received this message in error,
please immediately delete it and all copies of it and notify the sender.

More information about the XeTeX mailing list