Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • The typical advice for path is to either put all your files into one directory or use TEXINPUTS. Commented Jan 14, 2014 at 8:59
  • @MartinSchröder all of my latex source is in the same directory, actually. I'm documenting some program code that needs to be in another tree, and that's how this is actually arising. It's not uncommon, from what I've seen, though, to break larger documents into multiple files that reside in various subjects res, and that are referenced by relative path names. Commented Jan 14, 2014 at 11:40
  • 1
    @MartinSchröder Is it expected, then that relative pathnames in files are resolved against the current working directory of the pdflatex (latex, etc.) directory, rather than the directory containing the file? That seems to break the concept of a relative pathname. Shouldn't we expect \include{./foo.tex} in a file bar.tex to look for foo.tex in the same directory as bar.tex? Commented Jan 26, 2014 at 1:00
  • @JoshuaTaylor It's not the current file that processes itself, but the overall pdflatex process. If you do a complex C compilation, you can move from a directory to another and use relative paths, but only when compiling one of the .c files. Then a linking phase takes place, but there's no analogy with linking in TeX: everything is obtained in a unique run. One could modify \input (not \include, I'm afraid) to use a path relative to the file it's called from. Commented Jan 26, 2014 at 12:05
  • I am lazy, so I put my include file in $HOME (only have one include file), since that is searched by default by Latex. Otherwise, as others said, use $TEXINPUTS Commented Apr 5, 2014 at 0:11