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?


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.)


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.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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