*nix operating systems use the following shorthand: . denotes the present directory and .. denotes the parent directory. Names for directories can be conjoined with a /. So ../.. denotes the second directory up from the present directory. You can go down the hierarchy as well as up. Suppose the present directory is foo and bar is a sibling of the present directory:
|-- root/
|-- foo/ (the present directory)
|-- bar/
then ../bar/ would be the relative path for bar from foo (../ takes you up to root and bar/ takes you down to bar).
UNIX 101, I know, but what I did not know until just recently is that LaTeX accepts *nix relative paths. Which is awesome. That means complex LaTeX projects can live in a structured directory with, say, subdirectories for graphics. Suppose you are writing an article with graphics, your directory could be laid out as follows:
|-- mylatexproject/
|-- tex/
|-- article.tex
|-- graphics/
|-- mygraphic.jpg
To insert mygraphic.jpg in article.tex you could then use:
\insertgraphic{../graphics/mygraphic.jpg}
I plan to start work on my next book this summer. I am so glad that I sussed this out before then.
Post a Comment