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.

When I create a chapter

\documentclass[12pt]{memoir}
\usepackage{graphicx}
\renewcommand{\chaptername}{}

\begin{document}
\chapterstyle{veelo}
\chapter{Implementation}
\section{Implementation2}
\end{document}

It displays it like

Chapter 1
Implementation

How can I make it display

Implementation 1

I tried doing this

\renewcommand{\chaptername}{}

But it just hides the word chapter and does display implementation and 1 in the same line.

share|improve this question
    
With memoir there are several chapter styles already defined. See in the documentation; for example, crosshead and culver are similar to your request. –  Claudio Fiandrino Apr 11 '12 at 13:12
    
@ClaudioFiandrino I want to stick to using veelo style though. –  user972616 Apr 11 '12 at 13:21
add comment

1 Answer 1

up vote 4 down vote accepted

The following minimal example provides a solution to your problem. It modifies the \chapter header printing macros to print the chapter title in place of the chapter name (Chapter or \@chapapp):

enter image description here

\documentclass[12pt]{memoir}% http://ctan.org/pkg/memoir
\usepackage{graphicx}% http://ctan.org/pkg/graphicx (required with veelo chapter style)
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox

\makeatletter
\g@addto@macro\chs@veelo{%
  \renewcommand*{\printchaptername}[1]{%
    \chapnamefont\MakeUppercase{#1}}% Changed \@chapapp to #1; could also use \chaptitlefont
  \let\printchaptertitle\@gobble% Remove printing of chapter title.
}
\patchcmd{\@makechapterhead}% <cmd>
  {\printchaptername}% <search>
  {\printchaptername{#1}}% <replace>
  {}{}% <success><failure>
\makeatother

\begin{document}
%\tableofcontents
\chapterstyle{veelo}
\chapter{Implementation}
\section{Implementation2}
\end{document}

The veelo chapter style is stored in \chs@veelo, which defines the style in which the chapter title is printed. Appending (via \g@addto@macro) a renewed definition of \printchaptername (which now takes an argument), it replaces the former \@chapapp printing. If you want to maintain the former chapter title font, this can be modified to set it using \chaptitlefont. Additionally, the functionality of \printchaptertitle is removed (setting it to \@gobble).

\@makechapterhead actually sets the chapter heading. So, etoolbox is used to patch it and insert the newly created \printchaptername to take the supplied argument #1.

share|improve this answer
1  
Why not simply copy the veelo code from memoir.cls and make your own myveelo, that might be alightly easier than figuring out hos to patch the code (and figure out how it is stored internally) –  daleif Apr 11 '12 at 18:20
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.