[OS X TeX] Including jpg w/ graphicx
Morten Høgholm
morten.hoegholm at gmail.com
Tue Nov 22 22:32:10 CET 2005
On Tue, 22 Nov 2005 22:18:18 +0100, Ross Moore <ross at ics.mq.edu.au> wrote:
> Hi Chris,
>
> On 23/11/2005, at 7:59 AM, Christopher Allen wrote:
>
>>> or it may be the ~ that isn't appropriate, in which case
>>> it need to be the full path:
>>> e.g.
>>>
>>> \graphicspath{{/Users/rossmoor/Pictures/}}
>>
>> \graphicspath{{Users/callen/Pictures/}} does something. It really
>> doesn't like the \ before Users,
>
> It is a forward-slash / not backslash \ .
>
> This works perfectly for me.
> Using ~ does not work at all -- presumably since the shell
> that runs LaTeX doesn't expand the ~ when looking for files.
>
> 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.
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.
> Morten's suggestion of:
>
> \expandafter\graphicspath\expandafter{\expandafter{\detokenize{~/
> Pictures/}}}
>
> requires an appropriate expansion for \detokenize .
> That's rather technical to write, if you don't have it already.
Yes I just to show yet another places where this eTeX primitive turns out
to be very effective.
> 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
--
Morten
------------------------- 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