I write






    pdftitle={Sharelatex Example},


everytime i start a LateX document is there anyway to combine them into one package?

  • Making an one .sty file importing with \usepackage{...} and other stuff, without the \documentclass of course? -- The {\documentclass... troubles me,however
    – user31729
    Commented Oct 19, 2015 at 15:43
  • How to make one .sty file?
    – MrPajeet
    Commented Oct 19, 2015 at 15:44
  • 2
    @bgr95 but hopefully you never need lipsum in a real document. Commented Oct 19, 2015 at 15:49
  • 1
    @bgr95 anywhere in your input tree: just put it in the same directory as your document initially, till you get it working Commented Oct 19, 2015 at 15:50
  • 7
    @bgr95 including lots of packages you do not use is generally a bad idea. It has all the problems of slowing things down and risking weird errors due to package interactions, for no gain. Much better to just add packages as you need them. Commented Oct 19, 2015 at 15:52

1 Answer 1


Short way:

Make a file named, say mypackages.tex and copy all the \usepackage{...} statements and other stuff into that one.

In your real document use \documentclass[10pt]{report} and \input{mypackages} before \begin{document}...\end{document}

Longer way:

Make a file named mypackages.sty with this content:



% Other stuff from your frequent used files


Place this file either in your local working directory or in a local texmf directory (depends on the distribution/operating system)

In your real document you can use



In all cases replace \documentclass[10pt]{report} by the real settings -- it's only an example here!

  • 2
    \documentclass{yourclass}: Do you mean <whatever class you are using> or a custom class? At present it might be a bit confusing whether the instructions show how to make a .sty package or a .cls class. Commented Oct 19, 2015 at 22:56
  • @AndrewCashner: Good point, thanks -- I changed it to the class mentioned in the post
    – user31729
    Commented Oct 20, 2015 at 4:19
  • I don't have \NeedsTeXFormat in any of my packages…
    – cgnieder
    Commented Oct 20, 2015 at 9:39
  • @clemens: Your packages do not comply to any standard: They are outstanding :-P
    – user31729
    Commented Oct 20, 2015 at 14:19
  • I wanted to do this: Since I use windows I created a folder C:\Users\xyz\texmf\tex\latex where I saved my .sty file and everything works
    – MrPajeet
    Commented Nov 28, 2015 at 11:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .