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.

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

1 Answer 1

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
3
  • The feature should to switch on the appearance "Reference" in TOC, but it does not. Dec 12, 2014 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. Dec 12, 2014 at 17:41
  • It's work! That what I need. Thnx! Dec 12, 2014 at 17:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .