3

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}

1 Answer 1

4

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.

4
  • Thanks. I got it. What about the second question about numbering chapters manually? Have you got any idea? Commented Sep 22, 2016 at 3:52
  • 1
    @PhuocLuanDuong: To number a chapter as X, add \setcounter{chapter}{Y} where Y=X-1 just before \chapter.
    – Werner
    Commented Sep 22, 2016 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
    Commented Sep 22, 2016 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. Commented Sep 23, 2016 at 18:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .