Re: MacTeX and spaces in filenames
- From: real-address-in-sig@xxxxxxxxxxxxxxx (Rowland McDonnell)
- Date: Sun, 13 Apr 2008 15:24:50 +0100
Enrico Gregorio <gregorio@xxxxxxxxxxxxx> wrote:
Steve Checkoway <scheckoway@xxxxxxxxx> wrote:
(Rowland McDonnell) wrote:
I've just come across a curiosity:
if I have a filename with a space (or more than one) in it, and I ask
for \jobname in my TeX input file, I get a filename rendered with
unsexed double quotation marks around it.
MacTeX 2006, MacOS 10.4.11.
Anyone got any idea why this effect happens, and if there's any way of
getting the double quote marks to just not appear when I ask for
\jobname?
In the preamble:
\def\firstchar#1#2\end{#1}
\def\parsejob"#1"{#1}%
\edef\unquotedjobname{%
\if"\expandafter\firstchar\jobname\end
\expandafter\parsejob\jobname
\else
\jobname
\fi
}
After \begin{document}
\let\jobname=\unquotedjobname
I'm not sure you actually want to change \jobname though. I don't know
what the ramifications of that are. I do know that if you put the \let
before \begin{document}, LaTeX fails.
There are consequences: for example, no .toc file is produced and the
table of contents comes out wrong. The failure when the \let is before
\begin{document} is actually due to the impossibility to produce the
right file name for the .aux file. In fact LaTeX asks to open an
output stream with the name resulting from \unquotedjobname, i.e.,
\immediate\openout\@mainaux abc def.aux
(assuming "abc def.tex" is the TeX file name, without quotes). Indeed
a file abc.tex appears in the file system. With
\immediate\openout\@mainoux "abc def".aux
everything works properly.
Apparently, when a file with spaces in the name is input, MacTeX
defines the expansion of \jobname with double quotes around it, in such
a way that the OS is happy when producing names for auxiliary files.
That makes good sense - I thought it was something like that.
This has no consequences when babel modules making the double quote
character active, since the expansion of \jobname consists of category
code 12 characters anyway.
One can use \unquotedjobname (without making \jobname equivalent to it)
if the unadorned file name is needed, but not for defining auxiliary
file names.
OTOH, we all know that spaces in the file name are evil. :-)
<chuckle> Quite right - which is how come it's only just now, when I
ended up using a filename with spaces in for anomalous reasons, that I
noticed this `issue'.
But for my purposes, changing \jobname isn't needed; I just need
`\jobname's expansion without the quotes around it'.
So \unquotedjobname seems to be just what I need - thanks!
Rowland.
--
Remove the animal for email address: rowland.mcdonnell@xxxxxxxxxxxxxxx
Sorry - the spam got to me
http://www.mag-uk.org http://www.bmf.co.uk
UK biker? Join MAG and the BMF and stop the Eurocrats banning biking
.
- References:
- MacTeX and spaces in filenames
- From: Rowland McDonnell
- Re: MacTeX and spaces in filenames
- From: Steve Checkoway
- Re: MacTeX and spaces in filenames
- From: Enrico Gregorio
- MacTeX and spaces in filenames
- Prev by Date: Re: miktex matters
- Next by Date: space before cross-references in varioref
- Previous by thread: Re: MacTeX and spaces in filenames
- Next by thread: Using mathdesign Garamond with Adobe Garamond Pro
- Index(es):
Relevant Pages
|