TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've included a package in my tex file which requires a download from CTAN, so it's freely available just not in the default tex install.

I'm distributing my tex file, and would either like pdftex to fail silently on the missing package (or log a message explaining that the pdf "looks best with inclusion of blah"), or find a way to ship the tex file with the special sty's. What's the appropriate and conventional way to go about this?

share|improve this question
up vote 12 down vote accepted

There's \IfFileExists{file}{true}{false}, so you can check in advance if your \usepackage would be successful, and otherwise give a message using, in the simplest case, \typeout. (I always forget the syntax of LaTeX' proper macro for this... \PackageWarningNoLine{package name}{error message}, Google reveals.)

share|improve this answer

You could also use the filecontents environment (or package) to esentially ship multiple text files packed in one LaTeX source. (Check the docs for the filecontents package for more info.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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