including a file from a different directory

5,893 views
Skip to first unread message

L_inf

unread,
Feb 11, 2009, 3:38:26 PM2/11/09
to LaTeX Users Group
Hi,
when I run latex File.tex it gives:

! I can't write on file `../TeoriaDistribuciones.aux'.
\@include ...\immediate \openout \@partaux #1.aux
\immediate \write
\@partau...
l.49 \include{../TeoriaDistribuciones}

Please type another output file name: whatever
\openout2 = `whatever.tex'.

I'm trying to run a file that includes a file that is on another
directory. Is there a way to avoid this problem so the execution
doesn't have to stop and I don't have to type a made-up name every
time I run my document?
thanks in advance.

jon

unread,
Feb 12, 2009, 1:37:49 PM2/12/09
to LaTeX Users Group
On Feb 11, 3:38 pm, L_inf <schaffer...@gmail.com> wrote:
>
> I'm trying to run a file that includes a file that is on another
> directory. Is there a way to avoid this problem so the execution
> doesn't have to stop and I don't have to type a made-up name every
> time I run my document?
> thanks in advance.

perhaps import.sty?

you can then write:

\import{/home/<path to folder>/}{<file name without extension>}
% make sure to use the trailing `/' in your path.

cheers,
jon.

tullio facchinetti

unread,
Mar 15, 2009, 1:26:20 PM3/15/09
to latexus...@googlegroups.com
You can also try

\input{filename}

I prefer \input than \include for many reasons.

It should work even with files on other directories, if permissions are not an issue.

Tullio

Werner Grundlingh

unread,
Mar 15, 2009, 2:35:18 PM3/15/09
to LaTeX Users Group
...as a combination of both Jan & Tullio's posts, this should make
things clear:
\input{path/filename}
works where path can be absolute or relative. For example, compiling
your document in directory A with some file you which to include in a
subdirectory B can be done using
\input{B/filename}
or
\include{B/filename}
If the file to be included is in a different folder B on the same
level as A, relative directory structure/referencing also apply:
\input{../B/filename}
or
\include{../B/filename}

Hope this helps,
Werner
Reply all
Reply to author
Forward
0 new messages