회고록을 사용하는 동안 모든 섹션 제목 색상 변경

회고록을 사용하는 동안 모든 섹션 제목 색상 변경

최근에 문서를 에서 으로 변환 book했습니다 memoir. 호환되지 않는 것으로 나타났습니다 sectsty. 나는 이것을 가지고 있었다 :

\usepackage{sectsty}
\allsectionsfont{\color{blue}}

장, 섹션 및 하위 섹션을 포함하여 모든 섹션 제목의 색상을 매우 편리하게 변경했습니다. 내가 얻을 수 있는 가장 가까운 것은 무엇입니까 memoir?

답변1

클래스 memoir는 이러한 종류의 작업을 수행하기 위한 많은 후크를 제공하지만 장과 섹션은 다르게 처리됩니다. 매크로 \printchaptername는 장 이름을 인쇄합니다. 우리는 그것을 재정의하고 싶지 않기 때문에 매크로를 사용하여 정의 앞에 매크로를 \addtodef추가 하고 나머지는 변경하지 않았습니다.\color

목차를 어떻게 표시할지에 따라 변경할 수 있는 두 가지 매크로가 있습니다. 목차 제목만 변경하려는 경우 다른 패치 매크로가 \addtoiargdef사용됩니다. 해당 매크로는 인수를 사용하고 로 패치할 수 없기 때문입니다 addtodef.

섹션 형식화의 경우 초기에 로 설정된 각 섹션화 수준에 대해 빈 후크가 있습니다 {}. 매크로가 있습니다 \setSstyle(여기서 S섹션화 수준( sec, subsec, subsubsec)을 나타냄).

\documentclass{memoir}
\usepackage{xcolor}
\addtodef{\printchaptername}{\color{blue!50!black}}{}
\addtodef{\tocheadstart}{\color{blue!50!black}}{} % If you want the whole TOC to be blue also
%\addtoiargdef{\printtoctitle}{\color{blue!50!black}}{} % If you just want the TOC title blue
\setsecheadstyle{\color{blue!50!black}}
\setsubsecheadstyle{\color{blue!50!black}}
\begin{document}
\frontmatter
\tableofcontents*
\mainmatter
\chapter{A chapter}
\section{A section}
\subsection{A subsection}
\appendix
\chapter{An appendix}
\section{A section}
\subsection{A subsection}
\end{document}

부분 출력

관련 정보