2

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*{\chapterheadstart}{\vspace*{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}}
    \renewcommand*{\chapternamenum}{}
    \setlength{\beforechapskip}{18mm}
    \setlength{\midchapskip}{\paperwidth}
    \addtolength{\midchapskip}{-\textwidth}
    \addtolength{\midchapskip}{-\spinemargin}
    \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}
3

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*{\chapterheadstart}{\vspace*{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}}
  \renewcommand*{\chapternamenum}{}
  \setlength{\beforechapskip}{18mm}
  \setlength{\midchapskip}{\paperwidth}
  \addtolength{\midchapskip}{-\textwidth}
  \addtolength{\midchapskip}{-\spinemargin}
  \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}

non-zero sized number

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
  • 1
    @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

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.