0

I have file structure that looks like this:

images/
    1.png
    2.png
    3.png
photos/
    1.jpg
    2.jpg
    3.jpg
self/
    chapter1.tex
    chapter2.tex
    chapter3.tex
copied/
    chapter1.tex
    chapter2.tex
    chapter3.tex
main.tex

(and few other files, but that's not important here). Now I want to include those images and chapters inside main.tex, however I have a lot more than just 3 and I have been wondering if there is a way to specify default location to look into. As I am using graphix package, i have \graphicspath{{images/}{photos/}} for images, but is there something similar for content files as well?

EDIT: Change file structure to have content files divided into multiple folders

1 Answers1

2

You could simply define a new command for this:

\def\contentinput#1{\input{content/#1}}

Then

\contentinput{chapter1.tex}

will include the content of content/chapter1.tex.

If you want to have the same functionality as with \graphicspath (i.e., providing multiple paths), see Can a default path be set globally for \input{...} akin to \graphicspath{...}?.

magula
  • 409
  • This works, however, if I have multiple subfolders with content, I'd have to create a separate command for each one, while with \graphicspath I can specify more folders. Is there a way around that? – Redstone Tehnik Sep 26 '17 at 15:31
  • Sorry, but your question doesn't say so -- on the contrary, it's quite explicitly about one location. So please edit it so that gets clear. – magula Sep 26 '17 at 15:39
  • @RedstoneTehnik you can create a command with two arguments (first optional if you want) like: \newcommand\myinput[2][content]{\input{#1/#2}} and then use \myinput{chapter1.tex} or \myinput[content/extracont]{extra.tex} – koleygr Sep 26 '17 at 15:51
  • I've added a link to another question that's a duplicate, I think, and has an answer. – magula Sep 26 '17 at 15:54