4

I sometimes see \include{../foo} and \input{../bar.tex} in code examples online.

What does the ../ means? What does it changes? What are its advantages? How is it possible to use it?

1
  • LaTeX and TeX using Unix pathname protocols, even on MSDOS machines. Mar 21, 2019 at 4:20

2 Answers 2

3

Let us say you have the following structure:

LaTeXFiles (directory)
  foo.tex
  bar.tex
  test (directory)
    mwe.tex

Let us say you have the following line in file mwe.tex:

\include{../foo}

Then the file foo.tex in directory LaTeXFiles is included. So ../ means: go one directory back.

It simply used the path command available in windows with cd .. or cd test or cd LaTeXFiles/test or simular in unix/linux. Same with line

\input{../bar.tex}

It means the file bar.tex in directory LaTeXFiles is used in file mwe.tex.

2

../foo means that the file foo is located in the parent of the current working directory (one directory above it).

https://stackoverflow.com/a/23242061

1
  • You could also mention that in TeX this ../ relative syntax has some other beneficial uses such as with the file changed to an additional / e.g. with TeXINPUTS= the use of ..// means the parent all adjoining sibling subfolders and their child folders as well as this folders subfolders
    – user170109
    Mar 20, 2019 at 17:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .