# Can't get Veelo style chapter number in memoir class

I take the Veelo chapter style code in p.399 memman.pdf and make slight change on fontsize and colour. When I compile, it prints the word "Chapter" without the chapter number. I have two questions:

1. Why doesn't it print the chapter number? Am I missing something?

2. How can I manually number the chapters? For example, make something like \chapter[n]{ABC} that prints "Chapter n: ABC"

Here is the MWE

\documentclass[a4paper, 11pt]{memoir}
\usepackage{graphicx, xcolor}
\usepackage{lipsum}

\makeatletter
\newlength{\numberheight}
\newlength{\barlength}
\makechapterstyle{veelo}{%
\setlength{\afterchapskip}{40pt}
\renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt}
\renewcommand*{\chapnamefont}{\normalfont\LARGE\flushright\color{magenta}}
\renewcommand*{\chapnumfont}{\normalfont\HUGE}
\renewcommand*{\chaptitlefont}{\normalfont\Huge\bfseries\flushright\color{cyan}}
\renewcommand*{\printchaptername}{%
\chapnamefont\scshape{\@chapapp}}
\setlength{\beforechapskip}{18mm}
\setlength{\midchapskip}{\paperwidth}
\renewcommand*{\printchapternum}{%
\makebox[0pt][l]{\hspace{.8em}%
\resizebox{!}{\numberheight}{\chapnumfont\thechapter}%
\hspace{.8em}%
\rule{\midchapskip}{\beforechapskip}%
}}%
}
\makeatother
\chapterstyle{veelo}

\begin{document}
\chapter{Applications of the Derivative}
\lipsum[2]
\end{document}


You've resized the number to zero dimension.

\newlength{\numberheight}


Defines a length. By default, this is zero. Since you don't change it, you've made the number vanish. Replacing the default dimension, the number reappears, but you can obviously define \numberheight to whatever you intended and then replace it in your redefinition.

\documentclass[a4paper, 11pt]{memoir}
\usepackage{graphicx, xcolor}
\usepackage{lipsum}

\makeatletter
\newlength{\numberheight}
\newlength{\barlength}
\makechapterstyle{veelo}{%
\setlength{\afterchapskip}{40pt}
\renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt}
\renewcommand*{\chapnamefont}{\normalfont\LARGE\flushright\color{magenta}}
\renewcommand*{\chapnumfont}{\normalfont\HUGE}
\renewcommand*{\chaptitlefont}{\normalfont\Huge\bfseries\flushright\color{cyan}}
\renewcommand*{\printchaptername}{%
\chapnamefont\scshape{\@chapapp}}
\setlength{\beforechapskip}{18mm}
\setlength{\midchapskip}{\paperwidth}
\renewcommand*{\printchapternum}{%
\makebox[0pt][l]{\hspace{.8em}%
\resizebox{!}{\beforechapskip}{\chapnumfont \thechapter}%
\hspace{.8em}%
\rule{\midchapskip}{\beforechapskip}%
}}%
}
\makeatother
\chapterstyle{veelo}

\begin{document}
\chapter{Applications of the Derivative}
\lipsum[2]
\end{document}


To avoid confusion, I would recommend using a style name other than veelo since veelo is already defined. It will work this way, but it unnecessarily invites trouble down the line.

• Thanks. I got it. What about the second question about numbering chapters manually? Have you got any idea? – Phuoc Luan Duong Sep 22 '16 at 3:52
• @PhuocLuanDuong: To number a chapter as X, add \setcounter{chapter}{Y} where Y=X-1 just before \chapter. – Werner Sep 22 '16 at 5:23
• @PhuocLuanDuong The site works best when you ask one question per ... well, per question, really. I can't imagine why you'd want manual numbering in general but Werner's comment above says how to do it. – cfr Sep 22 '16 at 17:09
• @cfr Yep, Werner's solution fit me well. And the reason why I want manual numbering is that I'm making a demo chapter of my book, and since it is actually Chapter 3, I want to manually number it 3, not 1 by default. – Phuoc Luan Duong Sep 23 '16 at 18:23