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{%
\@ifclassloaded{book}{\@bookview}{}
\@ifclassloaded{extbook}{\@bookview}{}
}
\endinput
Since, the definition of the macro is made later, this situation causes an error.
\ProcessOptionsat any point. – Ruben Dec 14 '14 at 18:07\begin{document}. – Ruben Dec 14 '14 at 18:08