[OS X TeX] Including jpg w/ graphicx

Ross Moore ross at ics.mq.edu.au
Wed Nov 23 20:36:44 CET 2005


Hi Mortten,

On 23/11/2005, at 8:32 AM, Morten Høgholm wrote:

>> I'm using TeXshop  with:
>>     This is pdfeTeXk, Version 3.141592-1.11b-2.1 (Web2C 7.5.2)
>>
>> Morten, what are you using, that does (?) give expansion of ~ ?
>
> I'm running on  pdfeTeX, Version 3.141592-1.30.4-2.2 (Web2C 7.5.5)  
> but the problem is really that the ~ is expanded all the places  
> where LaTeX looks for a file name. Hence the file is never found.

It seems that there are at least 2 differences here, between your  
version (1.30.4)
of  pdfeTeX  and  my older (1.11b) version.

   a.  existence of the primitive  \detokenize
   b.  how the shell is setup for accessing underlying OS commands
        (e.g., expansion of ~ in file-names)

> When you're running in pdf-mode, each included image is assigned a  
> csname based on its name and path so that pdftex can just refer to  
> the object if encountered more than once. Now this is where it goes  
> wrong with an active ~ with the usual meaning because it contains  
> tokens that are illegal in csnames.

Certainly TeX's usual expansion of ~ needs to be suppressed.
This can be done either by using \string, or changing the
\catcode --- which is presumably what \detokenize does.

But without the ability of b. above, this is not sufficient.


>> Here's a way to trivially emulate ~ expansion:
>>
>>
>> \documentclass[letterpaper,10pt]{article}
>> \usepackage{graphicx}
>>
>> {%     restrict the re-definition of  ~
>> \def~{/Users/rossmoor}
>> \xdef\myPictures{{~/Pictures/}}
>> }%     returns ~ to normal, retaining  \myPictures
>>
>> \expandafter\graphicspath\expandafter{\myPictures}


> You could also do
>
> \edef\myPictures{{\string~/Pictures/}}
> \expandafter\graphicspath\expandafter{\myPictures}
>
> or the equally simple
>
> \catcode`\~=12
> \graphicspath{{~/Pictures/}}
> \catcode`\~=13

No; *I* cannot do this, on my older system.
Certainly I tried, without any success.


For me, the value of this thread has been two-fold:

    a.  getting Christopher (the OP) working;

    b.  discovering the differences in versions of  pdfeTeX
        and how these can affect ways of working.

Point b. is most relevant for situations of collaborative
work, such as multiple authors sharing the development of
a document. In this case, *all* of the solutions offered
here (including mine) are defective, since they cannot be
guaranteed to provide system-independent functionality.

Also, they would not have been discovered by an author
reading existing LaTeX documentation.


The only real solution --- under the added constraints of
sharing coding and images --- is for the directory paths
used in  \graphicspath{{...}{...}}  to be relative to
the working directory.

Under a Unix system (such as Mac OS X) this can be
achieved most elegantly by creating a symbolic link:

(in Terminal)
         ln -s ~/Pictures .

(note the final '.' here) and then just use

    \graphicspath{{Pictures}}

as if  Pictures/  were a real subdirectory.
Colleagues using M$ Windows, or Mac Classic, would need to
create this extra subdirectory and populate it with the images.


>
> -- 
> Morten


Thanks for an interesting and fruitful thread.

Cheers,

	Ross

------------------------------------------------------------------------
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 macostex-archives mailing list