TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that it is possible to include somedir/subdir/anotherfile.tex in somedir/file.tex by using \include{subdir/file}. Is it possible to do it the other way around?

A Linux workaround that I'm aware of is a symbolic link of somedir/file.tex to somedir/subdir/file.tex.

share|improve this question
up vote 14 down vote accepted

Use \include{../file}.

.. is UNIX for the parent directory, which Tex uses. See Kpathsea: Path searching.


Lev Bishop notes that this won't allow you to write to the parent directory, and that \include typically wants to write to a *.aux file in the parent directory. You can workaround the absence of write permission by setting TEXMFOUTPUT: on a Unix system, env TEXMFOUTPUT=.. latex mydoc will allow Latex to write (and overwrite) any file in the parent directory or any of its subdirectories when it compiles mydoc.tex.

This is somewhat safer than allowing overwriting everywhere the Tex binary has permission, and should work with Pdftex on both Texlive and Miktex (I'm not sure if TEXMFOUT is supported by Xetex).

share|improve this answer

With modern distributions, you can't, for security reasons: the idea is that tex input files should only allow files to be written at the same level or lower in the directory hierarchy, because tex will happily overrwrite preexisting files. Reading is ok, as with \input{../xyz} but the trouble is that \include{../xyz} causes writing of a file ../xyz.aux, which is not permitted.

One workaround is, as you said, to use symbolic links. Another (not recommended) is to deactivate the security feature:

  • in miktex: set environment variable MIKTEX_ALLOWUNSAFEOUTPUTFILES=1
  • in most other tex distributions, set openout_any=a

The best thing is to avoid needing to include files from parent directories. This is good anyway because then the structure of your files can mirror the logical structure of the document.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.