3

I'm having some problems modifying the veelo chapter style. Due to my smaller margins (I need A5 paper size), the regular veelo didn't work correctly. So instead of having the chapter number in the margin, I want it to be right aligned to the text block (see figure). I am doing that now by hard-coding it, but due to the different width of the various number characters it doesn't consistently work for all chapters. Also, the black box that extends outside of the trim marks is left-aligned to the number, causing the box to have different sizes for different chapter numbers.

My question: could you check out my code below and tell me what I'm supposed to change to 1) right-align the number to the text block, and 2) make the black box have the same size regardless of the number width?

Thanks so much!

Example chapter page

\makeatletter
\newlength{\numberheight}
\setlength{\numberheight}{\beforechapskip}

\newlength{\barlength}

\makechapterstyle{myveelo}{%
\setlength{\afterchapskip}{40pt}
\renewcommand*{\chapterheadstart}{\vspace*{40pt}}
\renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt}
\renewcommand*{\chapnamefont}{\normalfont\LARGE\flushright}
\renewcommand*{\chapnumfont}{\normalfont\HUGE}
\renewcommand*{\chaptitlefont}{\normalfont\HUGE\bfseries\flushright}
\renewcommand*{\printchaptername}{%
\chapnamefont\MakeUppercase{\@chapapp}\hspace*{\midchapskip}}
\renewcommand*{\chapternamenum}{}
\setlength{\beforechapskip}{18mm}
\setlength{\midchapskip}{\paperwidth}
\addtolength{\midchapskip}{-\textwidth}
\addtolength{\midchapskip}{-\spinemargin}
\addtolength{\midchapskip}{-11.5em}
\renewcommand*{\printchapternum}{%
\makebox[0pt][l]{\hspace{-1.5cm}%
\resizebox{!}{\numberheight}{\chapnumfont \thechapter}%
\hspace{1.8em}%
\rule{\midchapskip}{\beforechapskip}%
}}%
\makeoddfoot{plain}{}{}{\thepage}}

\makeatother
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – DG' Feb 21 '15 at 13:51
3

Your redefinition of \printchapternum has to be changed to something like

\renewcommand*{\printchapternum}{%
  \enspace\resizebox{!}{\numberheight}{\chapnumfont\thechapter}%
  \rlap{\hspace{1cm}\rule{\midchapskip}{\beforechapskip}}%
}%

change the 1cm I used to separate the number and the filled square to the desired value.

The complete code:

\documentclass{memoir}
\usepackage{graphicx}

\makeatletter
\newlength{\numberheight}
\setlength{\numberheight}{\beforechapskip}

\makechapterstyle{myveelo}{
  \setlength{\afterchapskip}{40pt}
  \renewcommand*{\chapterheadstart}{\vspace*{40pt}}
  \renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt}
  \renewcommand*{\chapnamefont}{\normalfont\LARGE\flushright}
  \renewcommand*{\chapnumfont}{\normalfont\HUGE}
  \renewcommand*{\chaptitlefont}{\normalfont\HUGE\bfseries\flushright}
  \renewcommand*{\printchaptername}{%
    \chapnamefont\MakeUppercase{\@chapapp}}
  \renewcommand*{\chapternamenum}{}
  \setlength{\beforechapskip}{18mm}
  \setlength{\midchapskip}{\paperwidth}
  \addtolength{\midchapskip}{-\textwidth}
  \addtolength{\midchapskip}{-\spinemargin}
  \addtolength{\midchapskip}{-11.5em}
  \renewcommand*{\printchapternum}{%
    \enspace\resizebox{!}{\numberheight}{\chapnumfont\thechapter}%
    \rlap{\hspace{1cm}\rule{\midchapskip}{\beforechapskip}}%
  }%
  \makeoddfoot{plain}{}{}{\thepage}%
}

\chapterstyle{myveelo}
\makeatother

\begin{document}

\chapter{Test chapter}
\setcounter{chapter}{100}
\chapter{Test chapter}

\end{document}

An image of the output:

enter image description here

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.