# chapter style: how to put a box on the egde like veelo style?

I would like to modify the BlueBox chapter style of the memoir documentation (below) in such a way that the bluebox is at the edge of the page, like the veelo style.

\documentclass{memoir}
\usepackage{fourier} % or what ever
\usepackage[scaled=.92]{helvet}%. Sans serif - Helvetica
\usepackage{color,calc}
\newsavebox{\ChpNumBox}
\definecolor{ChapBlue}{rgb}{0.00,0.65,0.65}
\makeatletter
\newcommand
*
{\thickhrulefill}{%
\leavevmode\leaders\hrule height 1\p@ \hfill \kern \z@}
\newcommand
*
\BuildChpNum[2]{%
\begin{tabular}[t]{@{}c@{}}
\makebox[0pt][c]{#1\strut} \\[.5ex]
\colorbox{ChapBlue}{%
\rule[-10em]{0pt}{0pt}%
\rule{1ex}{0pt}\color{black}#2\strut
\rule{1ex}{0pt}}%
\end{tabular}
}
\makechapterstyle{BlueBox}{%
\renewcommand{\chapnamefont}{\large\scshape}
\renewcommand{\chapnumfont}{\Huge\bfseries}
\renewcommand{\chaptitlefont}{\raggedright\Huge\bfseries}
\setlength{\beforechapskip}{20pt}
\setlength{\midchapskip}{26pt}
\setlength{\afterchapskip}{40pt}
\renewcommand{\printchaptername}{}
\renewcommand{\printchapternum}{%
\sbox{\ChpNumBox}{%
\BuildChpNum{\chapnamefont\@chapapp}%
{\chapnumfont\thechapter}} }
\renewcommand{\printchapternonum}{%
\sbox{\ChpNumBox}{%
\BuildChpNum{\chapnamefont\vphantom{\@chapapp}}%
{\chapnumfont\hphantom{\thechapter}}}}
\renewcommand{\afterchapternum}{}
\renewcommand{\printchaptertitle}[1]{%
\usebox{\ChpNumBox}\hfill
\parbox[t]{\hsize-\wd\ChpNumBox-1em}{%
\vspace{\midchapskip}%
\thickhrulefill\par
\chaptitlefont ##1\par}}%
}
\chapterstyle{BlueBox}
\begin{document}
\chapter{Introduction}
tata yoyo
\end{document}


the veelo chapter style:

the bluebox chapter style:

I would like to move the blue box on the left or on the right.

Thank you very much for your help! nbi

• You need to give a bit more guidance. For example, does the blue box get wider, or just shifted?; if wider, does the chapter stay centered in it or aligned to left or right? if shifted, does chapter number stay in the blue box or outside of it (like veelo)? etc. – Steven B. Segletes Aug 6 '14 at 12:51

Here's a first cut, but the OP would need to provide more information if he/she would like further refinement.

Changes from what the OP provided in his/her MWE are as follows

• The blue box is moved left by placing it in an \llap

• The blue margin on either side of the chapter number (argument #2 of \BuildChpNum) was increased from 1ex to 2ex

• The actual chapter number itself was placed in a fixed width \makebox, so that the blue box width does not change when the chapters become double-digit.

• 2cm of added padding was placed at the right side of the lapped box, to push the blue box to the margin.

• The \parbox that is used to set the chapter title (argument ##1 of \makechapterstyle) previously left a 1em gap as spacing from the blue box. Now that the blue box is lapped leftward, that 1em pad was removed, so that the chapter title becomes left aligned to the margin.

\documentclass{memoir}
\usepackage{fourier} % or what ever
\usepackage[scaled=.92]{helvet}%. Sans serif - Helvetica
\usepackage{color,calc}
\newsavebox{\ChpNumBox}
\definecolor{ChapBlue}{rgb}{0.00,0.65,0.65}
\makeatletter
\newcommand
*
{\thickhrulefill}{%
\leavevmode\leaders\hrule height 1\p@ \hfill \kern \z@}
\newcommand
*
\BuildChpNum[2]{%
\llap{\begin{tabular}[t]{@{}c@{}}
\makebox[0pt][c]{#1\strut} \\[.5ex]
\colorbox{ChapBlue}{%
\rule[-10em]{0pt}{0pt}%
\rule{2ex}{0pt}\color{black}\makebox[7ex]{#2}\strut
\rule{2ex}{0pt}}%
\end{tabular}\hspace{2cm}%
}}
\makechapterstyle{BlueBox}{%
\renewcommand{\chapnamefont}{\large\scshape}
\renewcommand{\chapnumfont}{\Huge\bfseries}
\renewcommand{\chaptitlefont}{\raggedright\Huge\bfseries}
\setlength{\beforechapskip}{20pt}
\setlength{\midchapskip}{26pt}
\setlength{\afterchapskip}{40pt}
\renewcommand{\printchaptername}{}
\renewcommand{\printchapternum}{%
\sbox{\ChpNumBox}{%
\BuildChpNum{\chapnamefont\@chapapp}%
{\chapnumfont\thechapter}} }
\renewcommand{\printchapternonum}{%
\sbox{\ChpNumBox}{%
\BuildChpNum{\chapnamefont\vphantom{\@chapapp}}%
{\chapnumfont\hphantom{\thechapter}}}}
\renewcommand{\afterchapternum}{}
\renewcommand{\printchaptertitle}[1]{%
\usebox{\ChpNumBox}\hfill
\parbox[t]{\hsize-\wd\ChpNumBox}{%
\vspace{\midchapskip}%
\thickhrulefill\par
\chaptitlefont ##1\par}}%
}
\chapterstyle{BlueBox}
\begin{document}
\chapter{Introduction}
tata yoyo
\setcounter{chapter}{9}
\chapter{New Section}
Testing double-digit chapter numbers

\end{document}


• Thank you very much! My problem was how to move this damn box. Now, that I know how to move it, I shall be able to do exactly what I want. I should have asked earlier, I am on this problem since this morning... xD – nbi Aug 6 '14 at 15:02