I have many common macros in all my documents. how can I move them all to external file, and include it in each document?

  • put them in mydefs.sty and then add \usepackage{mydefs} (however you do that in lyx) – David Carlisle Oct 14 '13 at 9:45
  • If that doesn't work, put them into a .tex file and use \include{mysdefs} or \input{mydefs}. You can also use relative or absolute addressing: \input{../folder/mydefs} – John Kormylo Oct 14 '13 at 13:22
  • @JohnKormylo -- \input is definitely preferable to \include for a file of macros, and \usepackage is the best of the lot. – barbara beeton Oct 14 '13 at 16:51
  • I use MikTeX/TeXnic and have never gotten \usepackage to work on a file I created. First of all, TeXnic will not allow you to create a STY file. You have to copy an existing STY file, rename it and replace the contents. More to the point, the STY files are all over the place. There must be a directory somewhere that tells MikTex where to look, and it does NOT include the local folder. – John Kormylo Oct 15 '13 at 3:33

Browse other questions tagged or ask your own question.