TeXShop, pdftex, Plain TeX, and image aliases?

  • Follow


I can insert PDF files into TeX output files using TeXShop, pdftex, 
Plain TeX, and the following rubric

   %   To insert a centered PDF image in TeXShop
   %
      \centerline{
         \pdfximage 
            width 5 in {file_name.pdf} 
         \pdfrefximage 
      \pdflastximage }
   %

and this works like a charm, provided that the "file_name.pdf" file to 
be inserted is in the same directory as the primary TeX source file 
that's being TeXed.

Is there a way to similarly insert a PDF file located in another 
directory -- for example by creating an alias to the file to be 
inserted in the same directory as the primary TeX source file, and 
putting the alias name into the above rubric in a form like

            width 5 in {file_name_alias} 

I don't seem to be able to make this work.
0
Reply siegman (1553) 9/7/2011 3:58:23 PM

On 11-09-07 10:58 AM, AES wrote:
> I can insert PDF files into TeX output files using TeXShop, pdftex, 
> Plain TeX, and the following rubric
> 
>    %   To insert a centered PDF image in TeXShop
>    %
>       \centerline{
>          \pdfximage 
>             width 5 in {file_name.pdf} 
>          \pdfrefximage 
>       \pdflastximage }
>    %
> 
> and this works like a charm, provided that the "file_name.pdf" file to 
> be inserted is in the same directory as the primary TeX source file 
> that's being TeXed.
> 
> Is there a way to similarly insert a PDF file located in another 
> directory 

There is a security requirement in TeX that explicitly included files be
in the same directory or in subdirectories.

There are a couple of ways to deal with this.

One of them is to put to list the directory that will include such
inputs within the TEXINPUTS environment variable.

If you set the TEXINPUTS environment variable to

   /path/to/dir/with/these/pdfs:

and be sure to include the trailing colon, then TeX will use your path
information (and will use its defaults where that colon is).

There may be a nice way of doing this through something like tlmgr

Also, the default TEXINPUTS may already include

 ~/Library/texmf/tex/latex

so you could put things in subdirectories of that.

My own TeX set-up has a lot of cruft in it, and I am not aware of what
the recommended ways of doing this is.

Cheers,

-j






-- 
Jeffrey Goldberg          http://goldmark.org/jeff/
I rarely read HTML or poorly quoting posts
Reply-To address is valid
0
Reply nobody30 (1816) 9/7/2011 5:40:48 PM


On 07/09/11 18:40, Jeffrey Goldberg wrote:
[...]
> There is a security requirement in TeX that explicitly included files be
> in the same directory or in subdirectories.

No, not at all. Not in TeX itself...in some output drivers. TeX is 
agnostic about where inputs come from. I just tested this by processing 
the example file in my Documents directory, but referencing a PDF file 
in /tmp. Works fine.

Dvips, however, is picky about the origin directory of included [E]PS 
files, because Postscript is a programming language, and a malicious EPS 
file belonging to someone else on your [shared] system, or inadvertently 
downloaded from somewhere, could contain enough code to let it do some 
damage to your printer.

[...]

> My own TeX set-up has a lot of cruft in it, and I am not aware of what
> the recommended ways of doing this is.

Use LaTeX instead. *Much* easier. But there may be other reasons we 
don't know of that prevent this.

///Peter
0
Reply Peter 9/7/2011 6:11:50 PM

Thanks, Jeffrey, recent response -- but:

1)  On my MacBook/SnowLeopard  I have the 2010 TUG MacTeX 
installation.  Doing a Spotlight search on my user/home directory 
brings up just one mention of "TEXINPUTS".  It's in the Section 5 of 
the MacTeX "Read Me First" document (the section entitled "For 
Experts" . . . ) -- this is its only occurrence in the document -- and 
it says

      On other Unix machines it is common to set environment 
      variables like TEXINPUTS.  While TEX Live recognizes these
      variables, it is usually not necessary or desirable to set
      them.

I think going further into this approach is beyond my pay grade.

2)  The rubric that's been working for me is

> >          \pdfximage 
> >             width 5 in {file_name.pdf} 
> >          \pdfrefximage 

where file-name.pdf is in the same directory as the TeX source file 
that I open with TeXShop.  

I've since tried moving file-name.pdf into a subfolder named Images 
within this same directory, and accessing it using

> >          \pdfximage 
> >             width 5 in {./Images/file_name.pdf} 
> >          \pdfrefximage 

and this also works (once I realized that the dot was required).

I suppose if I want to jump further, to some external folder, I'll 
have to put in a full path something like

> >          \pdfximage 
> >             width 5 in {~/Documents/ . . . .  /file_name.pdf} 
> >          \pdfrefximage 

I'll try it.

3)  As an irrelevant detail, if I use the working rubric from above, 
that is {file-name.pdf}, on a PDF file whose .pdf suffix does not 
explicitly appear in the Finder listing for the file, it still gets 
processed OK.

   --AES
0
Reply siegman (1553) 9/7/2011 8:25:16 PM

On 11-09-07 1:11 PM, Peter Flynn wrote:
> On 07/09/11 18:40, Jeffrey Goldberg wrote:
> [...]
>> There is a security requirement in TeX that explicitly included files be
>> in the same directory or in subdirectories.
> 
> No, not at all. Not in TeX itself...in some output drivers.

Thanks for the correction. I wasn't familiar with the mechanism he was
using to import, and thought it was through TeX itself.


>> My own TeX set-up has a lot of cruft in it, and I am not aware of what
>> the recommended ways of doing this is.
> 
> Use LaTeX instead. *Much* easier. But there may be other reasons we
> don't know of that prevent this.

Sorry for the ambiguity. When speaking of "my own TeX setup" I was
referring to my TeX Live installation. The cruft is the consequence of
migrating from my own, hand built, installation years ago to tetex
(compiled through fink and then later MacPorts) to now using TeX Live
installed through the MacTeX system.

Old, unmaintained, texmf trees are popping up in various places under my
home directory, and ancient versions of some common packages are getting
loaded.

I haven't yet poked around to see where local changes to texmf.cnf
should live.

Cheers,

-j


-- 
Jeffrey Goldberg          http://goldmark.org/jeff/
I rarely read HTML or poorly quoting posts
Reply-To address is valid
0
Reply nobody30 (1816) 9/7/2011 8:31:14 PM

Jeffrey Goldberg wrote:
> On 11-09-07 10:58 AM, AES wrote:
>> I can insert PDF files into TeX output files using TeXShop, pdftex, 
>> Plain TeX, and the following rubric
>>
>>    %   To insert a centered PDF image in TeXShop
>>    %
>>       \centerline{
>>          \pdfximage 
>>             width 5 in {file_name.pdf} 
>>          \pdfrefximage 
>>       \pdflastximage }
>>    %
>>
>> and this works like a charm, provided that the "file_name.pdf" file to 
>> be inserted is in the same directory as the primary TeX source file 
>> that's being TeXed.
>>
>> Is there a way to similarly insert a PDF file located in another 
>> directory 
> 
> There is a security requirement in TeX that explicitly included files be
> in the same directory or in subdirectories.

Actually, the security requirement applies only to the writing of files. 
Reading a file from something other than the working directory or a 
subdirectory is no problem.

Has the OP tried simply replacing

 >>             width 5 in {file_name.pdf}

by something like

               width 5 in {../other_directory/file_name.pdf}

with whatever the appropriate directory name is.

John Collins
0
Reply collins (32) 9/7/2011 8:34:11 PM

You can use a relative path as well. Two dots are necessary to get one
level higher.

So, if your .tex file is something like
~/Documents/texprojects/projectX/projectX.tex
(and you are in the working directory ~/Documents/texprojects/projectX)

and the image is
~/Documents/pdfimages/imageY.pdf,

use

\pdfximage
width 5 in {../../pdfimages/imageY}
\pdfrefximage








Dne 7.9.2011 22:25, AES napsal(a):

> I suppose if I want to jump further, to some external folder, I'll 
> have to put in a full path something like
> 
>>> > >          \pdfximage 
>>> > >             width 5 in {~/Documents/ . . . .  /file_name.pdf} 
>>> > >          \pdfrefximage 
> I'll try it.
0
Reply motarecuk (23) 9/8/2011 7:56:10 AM

In article <j49seq$tnt$1@dont-email.me>, "T.K." <motarecuk@seznam.cz> 
wrote:

> You can use a relative path as well. Two dots are necessary to get one
> level higher.
> 
> So, if your .tex file is something like
> ~/Documents/texprojects/projectX/projectX.tex
> (and you are in the working directory ~/Documents/texprojects/projectX)
> 
> and the image is
> ~/Documents/pdfimages/imageY.pdf,
> 
> use
> 
> \pdfximage
> width 5 in {../../pdfimages/imageY}
> \pdfrefximage

Thank you! -- I hadn't gotten to that level of understanding of 
"dotting" previously, and this _will_ be directly helpful in what I 
want to do.

> 
> 
> 
> 
> 
> Dne 7.9.2011 22:25, AES napsal(a):
> 
> > I suppose if I want to jump further, to some external folder, I'll 
> > have to put in a full path something like
> > 
> >>> > >          \pdfximage 
> >>> > >             width 5 in {~/Documents/ . . . .  /file_name.pdf} 
> >>> > >          \pdfrefximage 
> > I'll try it.
0
Reply siegman (1553) 9/8/2011 3:31:43 PM

7 Replies
59 Views

(page loaded in 0.121 seconds)


Reply: