# Memoir hangnum chapter style extended into margin

I'm trying to extend my chapter heading into the right margin. In the memoir manual an example of this is given for the companion chapter style using the adjustwidth environment.

I tried using that to adapt the hangnum chapter style, but now the chapter name is printed below the chapter number (on a new line). How can I fix this?

\documentclass{memoir}
\usepackage{lipsum}

\setlrmargins{*}{*}{2.5}
\checkandfixthelayout

\chapterstyle{hangnum}
\renewcommand{\printchaptertitle}[1]{%
\raggedright \chaptitlefont #1\par\nobreak

\begin{document}
\chapter{Very long title i i i i i i i i i i i i i i i i i i i i i i i i i i i i}
\lipsum[1]
\end{document}

• I found a solution here, which works in this MWE, but when I try to implement it I still get into trouble. My chapter titles are colored, and when I add '\color{blue}' the problem returns. Any ideas? – titto Aug 19 '17 at 8:43
• Found it. I should have used '\textcolor'. This works: '\renewcommand{\printchaptertitle}[1]{\makebox[0pt][l]{\parbox[t]{1.4\textwidth}{\raggedright\chaptitlefont\textcolor{blue}{#1}\par\nobreak}}}' – titto Aug 19 '17 at 9:12
• Would you like to turn your last comment into an answer? – Peter Wilson Aug 20 '17 at 17:57

This answers the original question (source):

\renewcommand{\printchaptertitle}[1]{%
\makebox[0pt][l]{\parb‌​ox[t]{1.4\textwidth}‌​{%
\raggedright\chapti‌​tlefont#1\par\nobreak}‌​
}
}


To make the color of the title blue use \textcolor{blue}{#1} like this:

\renewcommand{\printchaptertitle}[1]{%
\makebox[0pt][l]{\parb‌​ox[t]{1.4\textwidth}‌​{%
\raggedright\chapti‌​tlefont\textcolor{blue}{#1}\par\nobreak}‌​
}
}