10

I am using \chapterstyle{section} with \Huge\sffamily font. This means that some longer chapter titles spread over two lines. I get (a larger version of!)

2 A long title splitting as illustrated here
over two lines

with the second line starting at the left margin, when I'd like the second line to be indented to start under the first word of the title.

This must be easy to effect (without cheating and putting in an \hspace!), but I'm not seeing how from the memoir manual.

  • The MemoirChapStyles example for memoir shows how to set up very fancy chapter headings, with the relevant source code. Perhaps that suggests a solution to your problem. Some of the styles use largeish figures surrounding the chapter number, replacing that with a box might work. OTOH, I'd take seeing the overlong title as a strong nudge to shorten it... – vonbrand Jan 17 '13 at 3:01
  • A sample title that doesn't fit on one line is "Preliminaries about relations and functions" so not very long! Thanks for the pointer to the MemoirChapStyles.pdf document. But I can't (yet!) spot a solution to my simple(?) problem in the source codes for those much fancier layouts. – Peter Smith Jan 17 '13 at 8:28
8

It is not that simple. One might get by by using a hanging paragraph, here is another solution, which though has the disadvantage that one has to use \newline to force a line break

\documentclass[a4paper]{memoir}
\usepackage{calc}
\makechapterstyle{section}{%
  \chapterstyle{default}
  \renewcommand{\printchaptername}{}
  \renewcommand{\chapternamenum}{}
  \renewcommand{\chapnumfont}{\normalfont\Huge\bfseries}
  \renewcommand{\printchapternum}{}%\chapnumfont \thechapter\space}
  \renewcommand{\afterchapternum}{}
  \renewcommand\printchaptertitle[1]{%
    \begin{tabular}{@{} p{1cm} >{\raggedright\arraybackslash}p{\textwidth-1cm}}
      \chapnumfont\thechapter & \chaptitlefont ##1
    \end{tabular}
  }
}
\chapterstyle{section}
\begin{document}
\chapter{Some very long title that hopefully span two lines}
\end{document}

Edit: Looking though the memoir sources, it turns out this is very easy, have a look at the reparticle style, so this is enough

\makeatletter
\makechapterstyle{section}{%
  \chapterstyle{default}
  \renewcommand{\printchaptername}{}
  \renewcommand{\chapternamenum}{}
  \renewcommand{\chapnumfont}{\normalfont\Huge\bfseries}
  \renewcommand{\printchapternum}{}%\chapnumfont \thechapter\space}
  \renewcommand{\afterchapternum}{}
  \renewcommand*{\printchapternum}{%
       \@hangfrom{\chapnumfont \thechapter\quad}}%
}
\makeatother
| improve this answer | |
  • Tried the simpler version: it works a treat. Many thanks! – Peter Smith Jan 17 '13 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.