Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want a chapter subtitle (half the size of the font of the chapter title) within the rulers of the chapter title. The subtitle must not appear in the Table of Contents. I have this

\makechapterstyle{mychapterstyle}{%
    \renewcommand{\chapnamefont}{\LARGE\sffamily\bfseries}%
    \renewcommand{\chapnumfont}{\LARGE\sffamily\bfseries}%
    \renewcommand{\chaptitlefont}{\Huge\sffamily\bfseries}%
    \renewcommand{\printchaptertitle}[1]  {%
        \chaptitlefont\hrule height 0.5pt \vspace{1em}%
        {##1}\vspace{1em}\hrule height 0.5pt%
        }% 
    \renewcommand{\printchapternum}{%
        \chapnumfont\thechapter%
        }%
}
\chapterstyle{mychapterstyle}
\setsecheadstyle{\Large\sffamily\bfseries}
\setsubsecheadstyle{\large\sffamily\bfseries}
\setsubsubsecheadstyle{\normalfont\sffamily\bfseries}
\setparaheadstyle{\normalfont\sffamily}
\makeevenhead{headings}{\thepage}{}{\small\slshape\leftmark}
\makeoddhead{headings}{\small\slshape\rightmark}{}{\thepage}

Can someone help?

share|improve this question
add comment

migrated from stackoverflow.com Oct 16 '12 at 18:19

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 3 down vote accepted

The easiest might be to double the argument to \chapter by using both the (optional) ToC-entry as well as the (mandatory) sectional heading, removing the sub-heading from the former. Here's an example:

enter image description here

\documentclass{memoir}% http://ctan.org/pkg/memoir
\makechapterstyle{mychapterstyle}{%
    \renewcommand{\chapnamefont}{\LARGE\sffamily\bfseries}%
    \renewcommand{\chapnumfont}{\LARGE\sffamily\bfseries}%
    \renewcommand{\chaptitlefont}{\Huge\sffamily\bfseries}%
    \renewcommand{\printchaptertitle}[1]  {%
        \chaptitlefont\hrule height 0.5pt \vspace{1em}%
        {##1}\vspace{1em}\hrule height 0.5pt%
        }% 
    \renewcommand{\printchapternum}{%
        \chapnumfont\thechapter%
        }%
}
\newcommand{\chapsubhead}[1]{%
  \\{\normalsize #1}%
}
\chapterstyle{mychapterstyle}
\setsecheadstyle{\Large\sffamily\bfseries}
\setsubsecheadstyle{\large\sffamily\bfseries}
\setsubsubsecheadstyle{\normalfont\sffamily\bfseries}
\setparaheadstyle{\normalfont\sffamily}
\makeevenhead{headings}{\thepage}{}{\small\slshape\leftmark}
\makeoddhead{headings}{\small\slshape\rightmark}{}{\thepage}
\begin{document}

\tableofcontents*
\chapter[This is a chapter]% ToC entry
  {This is a chapter \chapsubhead{This is a sub-heading for this chapter}}

\end{document}​

The newly defined \chapsubhead inserts a forced line break, and groups the sub heading to localize any font changes (currently set to \normalsize). You could define a new macro like \chapsubheadfont that you can redefine however you want to. But it would seem that one would need a consistent formatting across your document, and therefore a macro containing this as-is should suffice.

The alternative might be to open the bowels of the \chapter setting and insert a subhead. An interface would have to be created or done similar to the \maketitle command of memoir where a definition is removed after it's used. This is what I mean by such a user interface:

\setchaptersubhead{This is a sub-heading for this chapter}
\chapter{This is a chapter}

where \chapter would remove any definition set by \setchaptersubhead once the chapter heading is complete (so it doesn't spill over to subsequent chapters). Although it can be done, this might be sufficient for your usage.

share|improve this answer
    
If carefull one can also overload \chapter to take an extra optional but braced option using the xparse package. –  daleif Oct 16 '12 at 20:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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