In Python we can import packages using

import packagename

or, if we only need a specific function, we can write

from packagename import functionname

Can something similar be done in LaTeX?

This would solve the common problem where a command is needed, the corresponding package is included, but later it turns out the command is not needed after all, but one forgets which package to remove.

1 Answer 1


No, this is impossible, and that's due to the fact that TeX is nothing like a procedural language. In Python, you have classes and functions, and you can clearly see what depends on what. In TeX, you can't see this at all, the package is typically one very complicated and self-intertwined monster.

You must log in to answer this question.

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