Macro call from options declaring part of the package

I need to call my macro inside DeclareOption, but my macro is defined later (this is the main condition).

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{MyBook}[2014/12/12]
\DeclareOption{llstyle}{\mymacro}
\ProcessOptions\relax

\RequirePackage{titlesec}
\RequirePackage{textcase}

\def\@bookview{
\let\cleardoublepage\clearpage
\renewcommand{\chaptertitlename}{Глава}

\titleformat{\chapter}[display]
{\vspace*{-10ex}\Large}
{\titleline[l]{\textls[200]{\MakeTextUppercase{\chaptertitlename}}\ \thechapter}\vspace{6pt}\titlerule[.8pt]}
{\dimexpr-\baselineskip+6pt\relax}
{\bfseries\MakeUppercase}
}

\def\mymacro{%
}
\endinput


Since, the definition of the macro is made later, this situation causes an error.

• Why not define the macro before declaring it? – A.Ellett Dec 14 '14 at 17:59
• @A.Ellett too easy:-) – David Carlisle Dec 14 '14 at 18:01
• Note that you can \ProcessOptions at any point. – Ruben Dec 14 '14 at 18:07
• Do you really want to execute the macro when calling the option 'some' or define it? In the first case you will definetely get an error message regarding \begin{document}. – Ruben Dec 14 '14 at 18:08
• @ A.Ellett "Why not define the macro before declaring it?" because macro require packages, which is call later, besides I had some problems with defining macro before \ProcessOptions set here tex.stackexchange.com/questions/3122/… – sergiokapone Dec 14 '14 at 18:18

\DeclareOption{some}{\AtEndOfPackage{\mymacro}}