How to check if a specific package is used by a LaTeX document. For example in the below document (intentionally written in an ugly but technically correct format), the packages fontenc, inputenc, csquotes, babel, libertine, amsmath, biblatex, filecontents, tikz are used but lettrine, cleveref, tocloft are not used (because they are in a comment area).

    \usepackage{babel, csquotes

               % lettrine

    \usepackage[backend=biber, style=authortitle]{biblatex} 




1 Answer 1


You should look into TeX-active-styles variable. For this document its value is

("url" "ifthen" "logreq" "kvoptions" "keyval" "etoolbox" "biblatex"
 "libertine" "amsopn" "amsbsy" "amstext" "amsmath" "tikz" "csquotes"
 "ngerman" "babel" "" "fontenc" "art10" "article" "latex2e" "z"

Then the function you should use is member:

(member "fontenc" TeX-active-styles)

This is the same check you should do for classes (see also this question).

In addition, if you want to check whether a certain option has been passed to package there is LaTeX-provided-package-options-member

(LaTeX-provided-package-options-member "fontenc" "T1")
  • Thank you very much for mentioning TeX-active-styles. I found it very useful variable. This correctly answers the question without using regular expressions.
    – Name
    Commented Sep 7, 2015 at 6:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.