[OS X TeX] path name

Ross Moore ross at ics.mq.edu.au
Fri Nov 18 19:02:50 EST 2005

Hi Peter, Friedrich, and others,

    What a great thread this has turned out to be.

On 19/11/2005, at 4:54 AM, Peter Dyballa wrote:

> Am 18.11.2005 um 17:42 schrieb Friedrich Vosberg:
>> Can this code convert umlauts in \jobname too?
> May be this way: echo "\jobname" | iconv -f UTF-8-MAC -t  
> ISO-8859-15 ...
> But you see: you have to 'outsource' the conversion anymway ...
> Since iconv seems to work quite nice for you: can you try it with  
> all the non-US ASCII characters? In one name, for example. Just to  
> find the limits. Once they're known early they can't surprise you  
> and maybe some means against it can be found ...

Here are some tips from my own explorations, guided by these ideas.

This works fine for me:

%% filename hällö.tex
   pwd | iconv -f UTF-8-MAC -t ISO-8859-1 |
     awk -F'\\n' '{print "\\gdef\\directorypath{" $1 "\\xspace}"}' >  
   echo "\jobname" | iconv -f UTF-8-MAC -t ISO-8859-1 |
     awk -F'\\n' '{print "\\gdef\\thisfile{" $1 "\\xspace}"}' >  
\catcode `\_ 12


Some remarks:

  1.  The input-encoding could be  [latin15] or any other, but then  
you would make
      the target (-t) of the  iconv  conversion commands match.

  2.  This also works with [utf8] but beware that you may still need  
a conversion:

              iconv -f UTF-8-MAC -t UTF-8

      This is because for filenames, the Mac OS uses "combining  
umlaut" at ^^cc^^88
      e.g. the filename is:  ha^^cc^^88llo^^cc^^88.tex
      rather than the (cleaner ?)   h^^e4ll^^f6.tex
       \usepackage[utf8]{inputenc}  handles the latter form, but not  
the former.

  3.  My directory path has an _ in a filename.
      This explains the need to  \catcode `\_ 12  before reading   
tmpdatei.tex .
      You need this inside a \begingroup ... \endgroup , which also  
has the \input
      commands. This means that the TeX assignments need to be done  
with the
      (global)  \gdef  command, rather than LaTeX's  \newcommand .
      Other special characters (e.g.  $ % ^ ~ @ # & ) in your file/ 
directory names
      may be handled similarly. ( Braces { } are slightly trickier to  

  4.  You can un-comment the  \show  commands, to see (in the Console  
      what you will be getting, before typesetting it.

And a word of warning.
Make sure that your  inputenc.sty  package and support files are  
quite recent.
There have been significant changes since 2002, especially to  UTF-8  
If  \usepackage[utf8]{inputenc}  causes  ucs.sty  to load, then it is  
time to update.

> --
> Mit friedvollen Grüßen
>   Pete

Hope this helps,


> Es ist in Chicago verboten, dort zu essen, wo es gerade brennt.

Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia  2109                            fax: +61 +2 9850 8114

------------------------- 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 MacOSX-TeX mailing list