2

I would like chapter names to not be printed but to appear in each section heading. For example:

\chapter{Mychapter}
\section{}
\blinddocument
\section{}

Would print something like

Mychapter 1
Mychapter 2

How can I achieve that? I've tried titlesec with \chaptertitle in \titleformat, like:

\titleformat{\section}[display]
  {\normalfont\Large}
  {\chaptertitle\ \thesection}{10pt}
  {\normalfont}

but \chaptertitle seems to be only defined inside \sethead and \setfoot.

To hide chapters and number sections properly, I've used:

\renewcommand{\thechapter}{}
\renewcommand{\thesection}{\arabic{section}}

but I'm sure there must be something better...

1 Answer 1

3

Try the following. It would not work for all the options of memoir, because it has two optional arguments for the \chapter command.

\documentclass{book}

\makeatletter
\let\oldchapter\chapter
\newcommand\chaphead{}

\renewcommand\chapter{%
    \@afterindentfalse
    \secdef\@mychapter\@schapter}

\def\@mychapter[#1]#2{%
    \addcontentsline{toc}{chapter}{#1}%
    \chaptermark{#1}%
    \addtocontents{lof}{\protect\addvspace{10\p@}}%
    \addtocontents{lot}{\protect\addvspace{10\p@}}%
    \renewcommand\chaphead{#2}}

\def\chaptermark#1{%
  \markboth {\MakeUppercase{#1}}{}}%

\def\sectionmark#1{%
  \markright{\MakeUppercase{%
    \ifnum \c@secnumdepth >\z@
      \arabic{section}. \ %
    \fi
    #1}}}

\renewcommand\thesection{\chaphead~\arabic{section}.}
\makeatother

\begin{document}
    \tableofcontents\clearpage
\chapter{First chapter}
\section{First section}
\section{Second section}
\end{document}
3
  • Thank you. This does what I am looking for as far as sections go, but it doesn't hide the chapter headings. How would I make it so that chapter headings don't appear in the document? I guess I could do a \renewcommand{\chapter}{something to adapt chapter} ?
    – raphink
    Apr 11, 2011 at 8:47
  • @Raphink: I have changed the code to retain the \chapter* command and chapter marks, but has removed the normal chapter heading. Note that the table of contents (if you are using it) is now a mess and also needs some redefinitions
    – Danie Els
    Apr 11, 2011 at 9:57
  • Ouch, that's redefining quite a few things at a low level. Is there no easy way to not print the chapter headings?
    – raphink
    Apr 11, 2011 at 11:59

You must log in to answer this question.

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