\DeclareOption의 Fancypagestyle

\DeclareOption의 Fancypagestyle

\DeclareOption내 수업에서는 페이지 레이아웃을 먼저 정의한 다음 선언 중에 수정하고 싶습니다 \newenvironment. 이를 위해 패키지를 사용하고 싶었습니다 fancyhdr. 이제 내 문제는 a) 패키지를 로드한 후에 패키지를 로드해야 \ProcessOptions하고 b) 환경에서 즉시 페이지 속성을 수정하거나 확장할 수 있는 방법을 모른다는 것입니다 \newenvironment. 내가 기본적으로 원하는 것(의사 코드):

\DeclareOption{test}{%
    \fancypagestyle{aSix}{%
    }
} 
\ProcessOptions
\newenvironment{test2}{%
\fancypagestyle{aSix2}{
%Takes the pagestyle aSix and update it with additional values}

어떻게 해야 하나요?

답변1

a와 함께 다른 접근 방식을 사용하고 conditionalclass 옵션이 사용되는 경우 \ifaSix이것을 truewith 로 설정하는 것이 좋습니다.\aSixtrue

기초 수업

\ProvidesClass{ishouldgivemoreinformation}

\newif\ifaSix
\DeclareOption{aSix}{\global\aSixtrue}


\ProcessOptions

\LoadClass{article}

\RequirePackage{fancyhdr}

\fancypagestyle{aSix}{%
  \fancyhead[C]{Foo}
  \renewcommand{\headrulewidth}{5pt}
}

\ifaSix
\fancypagestyle{aSix2}{%
  \pagestyle{aSix}%
  \fancyfoot[c]{Foobar}%
  % Some updates here
}
\else
\fancypagestyle{aSix2}{%
  \pagestyle{aSix}%
}
\fi

\endinput

driver.tex

\documentclass[aSix]{ishouldgivemoreinformation}


\pagestyle{aSix2}
\begin{document}
FOO
\end{document}

관련 정보