1

I have the following setup:

\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}

That is, I would like the chapter and section titles to be in small caps (sc option) and be in the margin (hangsecnum). At the same time, I would like the subsections to be in italic. How to achieve this?

3

2 Answers 2

1

From the documentation,, in the Quick reference section, you simply have to type

\titleformat*{\subsection}{\itshape}

Of course, if you have more complex requirements, you might have to use the Advanced interface.

4

The package titlesec is not compatible with memoir. See `titlesec` and `memoir` class incompability and About memoir and titlesec incompatibility

You can obtain the wanted effect with memoir tools.

\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}

enter image description here

If you want that the numbers are inside the margin, you can do

\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}

enter image description here

You might need to adjust the fixed 3pc space to fit big numbers.

8
  • I had to use titlesec for some other non-trivial function. But I agree that memoir has all the features on might wish for. Commented Sep 2, 2020 at 11:43
  • Thanks for this answer! Do you know how one might keep the numbers aligned with the text rather than in the margin but while keeping the titles of the section/subsection aligned? (Like in this image.) Thank you! Commented Jul 20, 2023 at 14:37
  • @LinoFerreira Are you using memoir?
    – egreg
    Commented Jul 20, 2023 at 16:00
  • Hi @egreg, yes I am! Commented Jul 20, 2023 at 16:20
  • 1
    @LinoFerreira Added in the answer
    – egreg
    Commented Jul 20, 2023 at 17:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .