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'd like to do something like the following (in pseudo-TeX)


For example, I know that a template file I wrote is used by people who don't have the mdframed package. So I want to write:


Is there anything that provides that kind of functionality?

share|improve this question
up vote 15 down vote accepted

Use \IfFileExists. Here's a code snippet from my idxlayout package that tests for the availability of ragged2e.

      Package ragged2e not available, therefore\MessageBreak
      substituting command raggedright for RaggedRight\MessageBreak
share|improve this answer
I added code like this to enable optional features in my packages which depend on other packages. However I got the impression that \IfFileExists already triggers MikTeX auto-install feature (I didn't do deeper tests). – Martin Scharrer Jan 22 '13 at 22:03




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.