3

I have my custom made package. I need to include (or activate) other package by some condition.

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{MyPackage}[2005/01/22]
\DeclareOption{connectbibliography}{\ActivetePackage{tocbibind}}
\ProcessOptions\relax
\RequirePackage{fancyhdr}
\endinput

Where \ActivetePackage some estimated command which is connect (or activate) the tocbibind package by passing connectbibliography in the key to the package in document via \usepackage[connectbibliography]{MyPackage}.

The implementation of this feature may, of course, be different than I have described.

  • Is \IfFileExists{?????.sty}{if yes}{if not} what you want? – Sigur Dec 12 '14 at 17:20
  • No, I want a feature which is activate/deactivate desired package instead use \RequirePackage{} – sergiokapone Dec 12 '14 at 17:24
4

If I understand the question, then:

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{MyPackage}[2005/01/22]
\def\dotocbind{}
\DeclareOption{connectbibliography}{\def\dotocbind{\RequirePackage{tocbind}}}
\ProcessOptions\relax
\dotocbind
\RequirePackage{fancyhdr}
\endinput
  • The feature should to switch on the appearance "Reference" in TOC, but it does not. – sergiokapone Dec 12 '14 at 17:37
  • @sergiokapone it was virtually impossible to guess the intent of the question. the only part that I thought I understood was that if [connectbibliography] is passed to your package then tocbind should be loaded, which is what this does. If that isn't what you want perhaps you should edit the question to show an example document and stare the required output. – David Carlisle Dec 12 '14 at 17:41
  • It's work! That what I need. Thnx! – sergiokapone Dec 12 '14 at 17:44

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.