0

I would like to change the indentation of title names in the text independent of the numbers, so that the title names have a specific distance from the margin.
Instead of:

01 Chapter
01.01 Section
01.01.01 Subsection
01.01.01.01 Subsubsection

Something like this:

01           Chapter
01.01        Section
01.01.01     Subsection
01.01.01.01  Subsubsection

If possible, I would like independent control of each type of heading.

Faergen
  • 531
  • 5
  • 14
  • What are you looking for? A solution for the toc or for the text itself? Please add an MWE. – C. Peters May 16 '21 at 13:54
  • The text itself. I don't know how to make a minimal working example, because I cannot make it work at all. That is, from looking in the memoir manual, there seems to be no direct commands for controlling the distance between section numbers and section names. – Faergen May 16 '21 at 15:36
  • You need to add a formatter to the chapter and section macros that typesets the number part in a box of a certain width. And you should provide a minimal example of what you have so far, as (1) 01.01.01 is not standard and you don't write how you get it. (2) handling chapter requires knowledge about which chapter style you use or how you defined it. Additionally please update the question to specify that this is for the text, not the toc as this is not clear. – daleif May 16 '21 at 16:47
  • Yes, you are right, I should not have put the two-digit numbering in the question. I did update the question after my previous comment, adding "in the text". – Faergen May 17 '21 at 05:52
  • 1
    Thank you for your feedback. I updated the answer to align the baselines. – Simon Dispa May 17 '21 at 13:13

1 Answers1

2

Updated You put the section numbers in a box of a suitable size (used 70pt here). For the chapter it is also necessary to define a new format.

Combining with the answer to your previous question this is the result:

wx

with this code:

\documentclass[openany]{memoir}

\newlength{\fitnumbers} \setlength{\fitnumbers}{70pt}% set to fit <<<<<<<<<<<<<

\setsecnumformat{\makebox[\fitnumbers][l]{\csname the#1\endcsname}} \setsecnumdepth{subsubsection}

\makeatletter
\makechapterstyle{Astyle}{% \def\chapterheadstart{\vspace*{\beforechapskip}} \def\printchaptername{} \def\printchapternum{} \def\printchapternonum{} \def\printchaptertitle##1{\chaptitlefont \makebox[\fitnumbers][l]{\thechapter}##1} \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip} }

%% From https://tex.stackexchange.com/questions/596989/two-digit-sectioning-in-memoir-class?rq=1 \renewcommand{\thechapter}{\two@digits{@arabic\c@chapter}} \renewcommand{\thesection}{\thechapter.\two@digits{@arabic\c@section}} \renewcommand{\thesubsection}{\thesection.\two@digits{@arabic\c@subsection}} \renewcommand{\thesubsubsection}{\thesubsection.\two@digits{@arabic\c@subsubsection}} \makeatother

\chapterstyle{Astyle}

\begin{document}

\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}

\end{document}

Simon Dispa
  • 39,141
  • Thank you, this is 90 % there. I can see, that your result is the same as mine - the number is slightly misaligned with the text. How do I align the parbox with the chapter and section names? – Faergen May 17 '21 at 05:54
  • 1
    @Faergen Please see the updated answer. – Simon Dispa May 17 '21 at 13:12