I am trying to use imakeidx and the regexpatch package in the same class. Since imakeidx depends on the xpatch package and xpatch provides the same commands (same names, improved implementation) as regexpatch this gives errors (redefining commands). Is there anyway to pretend I loaded the xpatch package, so the require inside imakeidx won"t load anything? (Since I load regexpatch before, everything should be fine).

While I have a concrete example above, I would be interested in the general answer to prevent require statements from loading packages, a workaround for my particular case is a bonus (I guess either I am doing something wrong or the package author will take a look).

  • @egreg I think you might be the author of both packages, so I wanted to notify you. On page 17 line 37 of the imakeidx manual, it seems like you \RequirePackage{xpatch} unconditionally. – ted Aug 21 '13 at 21:33
  • 4
    \ProvidesFile{wibble.sty} will make latex think that the wibble package has been loaded. – David Carlisle Aug 21 '13 at 21:45
  • 1
    ...or \makeatletter\let\ver@wibble\@empty\makeatother (I think). – Werner Aug 21 '13 at 21:52
  • @Werner \csname ver@wibble.sty\endcsname (so that wibble class and wibble package can both exist – David Carlisle Aug 21 '13 at 21:55
  • 1
    @ted FYI, trying to notify someone the way you did with egreg doesn't work unless egreg is the author of the post, or if he/she has written a comment. If as you type the name it starts to auto-complete, the person will be notified, if it doesn't autocomplete, the person won't. See here: meta.stackexchange.com/questions/123594/… – Chris Gregg Aug 22 '13 at 8:23

One can use David's suggestion, but etoolbox must be loaded anyway:


should do.


egreg answered the specific issue but the general issue of avoiding package loading as mentioned in comments:




\typeout{longtable is: \meaning\longtable}



longtable is: undefined

showing that the package is not loaded, despite the \usepackage.

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.