Hi everybody,
I'm working on modifying the subsection heading style in a customised document class I'm building, so that the \subsection command would provide the following output:
%
This is a sentence. This is another sentence. And another to make the text run over to the following line.
%
\vspace{\baselineskip}
\fancybreak{\centering*\,*\,*}
\vspace{\baselineskip}
%
\noindent \textsc{\MakeLowercase{Subsection Heading I.}} This is a sentence. \marginpar{\S\,i}This is another sentence. And another to make the text run over to the following line.
The idea is to have both a runin heading, in small caps, and a hanging subsection heading number in the margin, 1em away from the text border. The distance between the preceding paragraph and the new subsection should if possible be fixed. I've tried to do all this with the titlesec package, but to no success since the titlesec package does not allow for both runin and hanging headings.
I've also had some problems with two options I've written for my class, which is also in connection with headings. Basically the idea is to have two option, one called ``short,'' and the other ``long'' which would change the heading style depending on whether the document was short or long. I enclose the following minimal working example:
\ProvidesClass{CustomClass}
\LoadClassWithOptions{memoir}
\RequirePackage[calcwidth]{titlesec}
\DeclareOption{short}{%
\renewcommand\thechapter{\Roman{chapter}}%
\titleformat{\chapter}[block]{\normalfont\bfseries\centering}{\thechapter.}{0.6em}{}%
\titlespacing*{\chapter}{0em}{1.5em plus 0.2em minus 0.2em}{2\baselineskip}%
%
\renewcommand\thesection{\arabic{section}}%
\titleformat{\section}[block]{\normalfont\bfseries}{\S\,\thesection.}{0.4em}{\raggedleft}%
\titlespacing*{\section}{0em}{1.5\baselineskip}{\baselineskip}%
}%
\DeclareOption{long}{%
\renewcommand\thechapter{\Roman{chapter}}%
\titleformat{\chapter}[display]{\normalfont\large\raggedleft}{Chapter \thechapter.}{0.4em}{\normalsize\Large%
\titleline*[r]{\titlerule[1pt]}\vspace{0.2em}}%
\titlespacing*{\chapter}{0em}{1.5em plus 0.2em minus 0.2em}{2\baselineskip}%
%
\renewcommand\thesection{\arabic{section}}%
\titleformat{\section}[block]{\normalfont\bfseries}{\S\,\thesection.}{0.4em}{\raggedleft}%
\titlespacing*{\section}{0em}{1.5\baselineskip}{\baselineskip}%
}%
Any help would be greatly appreciated,
Cedric Cordenier
Document Classes ⇒ Problem With Subsection and Options in Memoir-based Class
-
- Posts: 6
- Joined: Mon Feb 22, 2010 10:03 pm
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Problem With Subsection and Options in Memoir-based Class
It is essential that you tag code as such by using the code environment of the forum to keep a post clear and legible!
Read Section 6.6 (Lower level headings, p. 103ff) of the memoir manual and you will see that you don't need the titlesec package.
Best regards and welcome to the board
Thorsten
Read Section 6.6 (Lower level headings, p. 103ff) of the memoir manual and you will see that you don't need the titlesec package.
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 6
- Joined: Mon Feb 22, 2010 10:03 pm
Re: Problem With Subsection and Options in Memoir-based Class
Thank you very much!
I'll try to tag code in the future.
Have a good evening,
Cedric Cordenier
I'll try to tag code in the future.
Have a good evening,
Cedric Cordenier
-
- Posts: 6
- Joined: Mon Feb 22, 2010 10:03 pm
Problem With Subsection and Options in Memoir-based Class
Hello again,
I have used the memoir provided commands to create a heading document option as suggested, but have bumped into another issue. The memoir documentation suggests using the
command to change the format of the numbers, but this change is applied throughout the headings, so if I want a section heading to be displayed in the following format
§ [section number] SECTION 1
by modifying \setsecnumformat to be
then all chapter, section, subsection, etc. headings will be displayed using this format. I also tried redefining \thesubsection, according to the following
and got much close to what I intended, with only one little hiccup, that is that the format § [section number] was then also displayed in the table of contents, something which I want to avoid...
Furthermore, I was unable to find a way to have the subsection number displayed 0.5em from the textblock, in the margin. An example of what I would like to have as subsection heading can be found in my original post.
Would anyone be able to help me out?
Many thanks,
Cedric
I have used the memoir provided commands to create a heading document option as suggested, but have bumped into another issue. The memoir documentation suggests using the
Code: Select all
\setsecnumformat
command to change the format of the numbers, but this change is applied throughout the headings, so if I want a section heading to be displayed in the following format
§ [section number] SECTION 1
by modifying \setsecnumformat to be
Code: Select all
\setsecnumformat{\S\,\csname the⩨1\endcsname \hspace{0.5em}}
Code: Select all
\renewcommand\thesubsection{\S\,subsection}
Furthermore, I was unable to find a way to have the subsection number displayed 0.5em from the textblock, in the margin. An example of what I would like to have as subsection heading can be found in my original post.
Would anyone be able to help me out?
Many thanks,
Cedric