Possible Duplicate:
Conditional “if a package is available”

I'm pretty lazy, and have my own .sty files which import a bunch of commonly used features. But, sometime system installations fail to provide one, for example Ubuntu's LaTeX doesn't have the mathtext package. So, is there a way to have a \usepackage command that won't cause (Xe)LaTeX to fail if a package isn't found?

marked as duplicate by Martin Scharrer Nov 7 '11 at 10:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I am not too sure if I understand the logic. If the file does not exist (you can use ifFileExists to check) you can stop the error for the package, but how about the commands that you are using from the package in the first place? – Yiannis Lazarides Nov 7 '11 at 9:33
  • @YiannisLazarides for a package like mathastext it makes sense, since the document will compile without it… – Seamus Nov 7 '11 at 9:37
  • @YiannisLazarides: I'm using something like this in my package manuals to load font packages only if installed. After all, a manual in the standard font is much better than no manual :-) – Martin Scharrer Nov 7 '11 at 9:38
  • @MartinScharrer In a package or class it makes sense, but in a preamble you should only load what you are going to use, otherwise it ends up like a collection of antiques:) – Yiannis Lazarides Nov 7 '11 at 10:16
  • @Seamus ... you should try using manuscript sometimes as an alternative:) – Yiannis Lazarides Nov 7 '11 at 10:16