1

Is it possible to make a kind of inheritance while working with big projects in LaTeX?

I think of a tree like inheritance where each child (which are tex-files) inherits the packages and commands of the parent but is able to overwrite same package with other options for example?

For Example:

%Root.tex
\usepackage{pkg1}
\usepackage[optls]{pkg2}

%child1.tex
\input{Root.tex}
\usepackage{pkg3}

%child2.tex
\input{child1.tex}
\usepackage[newoptls]{pkg2}

Be aware, that those files will be in different folders, and all child files are in sub folders of the root file. So there is a command in Latex to set the root path for all files, but I don't remember and can't find.

  • 2
    basically no, if you include the same package twice with different options latex will issue an error – David Carlisle Oct 2 '14 at 11:48
  • Basically. And is there an advanced way? – Rafael Wörner Oct 2 '14 at 21:37
  • 3
    Sorry your question isn't specific enough on your real intention.. the answer to your question as written is no but I can't really guess your real need. If the document is a single document spread over multiple files, there can only be one preamble and one set of packages loaded. If the multiple files are separate documents they can of course have independent preambles. – David Carlisle Oct 2 '14 at 21:41
  • Some packages include commands which make it easy to overwrite previously set options. So if your concern is with such a package, you could do something like this but not with \usepackage. – cfr Oct 3 '14 at 2:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.