I have a personalized style file (say main.sty) which I use for all my writings. In some writings however, there is a package in main.sty that I would not like included. As a concrete example, in main.sty I am calling the package eucal. However, for whatever reason, I do not want to include it in the particular .tex file that I am current working in. Is there a command to "remove" that package. What I am looking for is a code like



What should replace \donotusepackage{eucal}?

PS - Having thought of this, I think one solution would be to have the inclusion/non-inclusion of the package eucal as an option in main.sty. Then, we can have something like \usepackage[noeucal]{main}. Is this the only solution?

  • 3
    Your solution is what I would use. It's not difficult. I'm not aware of anything that can systematically remove a package once loaded. Apr 4, 2018 at 14:49
  • 1
    You can also take it a step further, with your [noeucal] option: AtBeginDocument you can check to see if the package was loaded, then throw an error. That would prevent you from manually requesting the package in preamble.
    – user139954
    Apr 4, 2018 at 14:55
  • One KOMA script package provides preventpackage from loading.
    – Johannes_B
    Apr 4, 2018 at 15:38

1 Answer 1


You can add this in your main.sty






That will provide two options to main package : Eucal (default) load eucal.sty and noEucal that doesn't.


  • This works perfectly and does what I need. Thanks!
    – Prahar
    Apr 4, 2018 at 17:01

You must log in to answer this question.

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