0

I would like to reuse a piece of code from the preamble in multiple .tex documents. I can just copy and paste that code in all my documents, however, if later on I decide to modify the code I need to re-apply the modifications in all documents. Does LaTeX offer something like an import?

cgnieder
  • 66,645
  • well you are already reusing lots of code with packages and class, so yes, latex does offer this. Put your code in "zoltan.sty", put the sty where it can be found and then use \usepackage{zoltan} in your documents. – Ulrike Fischer Mar 18 '22 at 10:42
  • What do you mean by put the sty where it can be found ? Do sty files have a specific directory or they can be put in the same directory with the document? – Zoltan King Mar 18 '22 at 11:10
  • Does LaTeX offer something like an import? It does. E.g., via the commands \usepackage, \RequirePackage and \input. – Ulrich Diez Mar 18 '22 at 11:11
  • @ZoltanKing Files belonging to or related to a TeX-distribution are organized in the so-called TeX-Directory-Structure. The link provides a rough overview about how TeX searches/finds files. – Ulrich Diez Mar 18 '22 at 11:15

0 Answers0