memoir + titlesec: サブセクションの形状を変更する

memoir + titlesec: サブセクションの形状を変更する

次のような設定になっています:

\documentclass{memoir}
\usepackage[sc]{titlesec} % "sc" to make titles small cap

\setsecnumdepth{subsection} % to number up to subsection

\hangsecnum % to make the numbers hanging in the margin

\begin{document}
    \chapter{Test chapter}
    \section{Test chapter}
    \subsection{Test chapter}
\end{document}

つまり、章と節のタイトルを小文字 (scオプション ) にして余白 ( hangsecnum) に配置したいのです。同時に、サブセクションを斜体にしたいのです。どうすればこれを実現できるでしょうか?

答え1

ドキュメントによると、、クイックリファレンスセクションでは、単に入力するだけです

\titleformat*{\subsection}{\itshape}

もちろん、より複雑な要件がある場合は、 高度なインターフェース

答え2

パッケージtitlesecは と互換性がありませんmemoir`titlesec` と `memoir` クラスの非互換性そして回想録とタイトルセックの非互換性について

ツールを使用すると、必要な効果を得ることができますmemoir

\documentclass{memoir}

\setsecnumdepth{subsection} % to number up to subsection

\renewcommand{\chapnamefont}{\normalfont\huge\scshape}
\renewcommand{\chapnumfont}{\normalfont\huge\scshape}
\renewcommand{\chaptitlefont}{\normalfont\Huge\scshape}

\setsecheadstyle{\Large\scshape\memRTLraggedright}
\setsubsecheadstyle{\large\itshape\memRTLraggedright}
\setsecnumformat{\makebox[0pt][r]{\upshape\csname the#1\endcsname\quad}}
% or just \hangsecnum if you want the number to inherit the same font as the title

\begin{document}

\chapter{Test chapter}
\section{Test section}
\subsection{Test subsection}

\end{document}

ここに画像の説明を入力してください

数字を余白内に収めたい場合は、次のようにします。

\documentclass{memoir}

\setsecnumdepth{subsection} % to number up to subsection

\renewcommand{\chapnamefont}{\normalfont\huge\scshape}
\renewcommand{\chapnumfont}{\normalfont\huge\scshape}
\renewcommand{\chaptitlefont}{\normalfont\Huge\scshape}

\setsecheadstyle{\Large\scshape\memRTLraggedright}
\setsubsecheadstyle{\large\itshape\memRTLraggedright}
\setsecnumformat{\makebox[3pc][l]{\upshape\csname the#1\endcsname\quad}}

\begin{document}

\chapter{Test chapter}
\section{Test section}
\subsection{Test subsection}

\end{document}

ここに画像の説明を入力してください

大きな数字を収めるには、固定された 3 個のスペースを調整する必要があるかもしれません。

関連情報