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` 類別不相容關於回憶錄和 titlesec 不相容性

透過工具就可以達到想要的效果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 件空間以適應大數字。

相關內容