# How to use this chapter style such that it takes up less space?

I like the box chapter style from here: http://hstuart.dk/2007/05/21/styling-the-chapter/

Here is a MWE based on this style:

\documentclass{memoir}
\usepackage{tikz, blindtext}
\makechapterstyle{box}{
\renewcommand*{\printchaptername}{}
\renewcommand*{\chapnumfont}{\normalfont\sffamily\huge\bfseries}
\renewcommand*{\printchapternum}{
\flushright
\begin{tikzpicture}
\draw[fill,color=black] (0,0) rectangle (2cm,2cm);
\draw[color=white] (1cm,1cm) node { \chapnumfont\thechapter };
\end{tikzpicture}
}
\renewcommand*{\chaptitlefont}{\normalfont\sffamily\Huge\bfseries}
\renewcommand*{\printchaptertitle}[1]{\flushright\chaptitlefont##1}
}
\chapterstyle{box}
\begin{document}
\chapter{Fancy chapter with TikZ}
\blindtext
\end{document}


Now I would like to eliminate some of the white space indicated by 1 and 2 (so above and below the box, but mostly above the box). Of course there should be a bit of white space, but I don't want the chapter headings to take up much space so it should be rather small. Any ideas on how I can achieve this?

Bonus question: is it possible to do all while allowing me to use the report class (I don't know what possible disadvantages the memoir class could bring me later on)?

• The memoir class has many more features than report; use it. – egreg May 1 '15 at 10:11

There you are.

\documentclass{report}
\usepackage{tikz, blindtext,showframe}  %% blindtext,showframe just for demo
\usepackage{titlesec}
\newcommand*{\chapnumfont}{\normalfont\sffamily\huge\bfseries}
\newcommand*{\chaptitlefont}{\normalfont\sffamily\Huge\bfseries}
\newcommand{\mybox}{%
\begin{tikzpicture}
\draw[fill,color=black] (0,0) rectangle (2cm,2cm);
\draw[color=white,font=\chapnumfont] (1cm,1cm) node {\thechapter};
\end{tikzpicture}%
}
\titleformat{\chapter}[display]
{}{\filleft\mybox}{20pt}{\filleft\chaptitlefont}
\titlespacing*{\chapter} {0pt}{0pt}{0pt}
\begin{document}
\chapter{Fancy chapter with TikZ}
\blindtext
\end{document}


Adjust values in \titlespacing*{\chapter} {0pt}{0pt}{0pt} which is \titlespacing*{\chapter} {0pt}{50pt}{40pt} by default, I have made them all zero.

The 20pt in ...\mybox}{20pt}... in \titleformat is the vertical space between chapter number and title. Adjust if you want.

• The OP is using memoir. – egreg May 1 '15 at 10:10
• @egreg I think you missed the bonus question ;-) – user11232 May 1 '15 at 10:10
• @egreg I am of the impression that the OP wants to use report class – user11232 May 1 '15 at 10:12
• Thanks a lot! To clarify: I was using the report class till I stumbled upon this chapter style that used the memoir class. I know little of the features of the memoir class, so that's why I thought it might be best to stick to what I have. Or which class would you say is best? – texfan May 1 '15 at 10:17
• @texfan memoir has lot of features. But all that can be had with report class too by yourself. That is the only difference. Choice is yours. Personally I don't use memoir. There are also koma classes like scrbook etc which have features too just for your information. – user11232 May 1 '15 at 10:36

You want to set the specific parameters of memoir:

\documentclass{memoir}
\usepackage{tikz, blindtext,showframe}
\makechapterstyle{box}{%
\setlength{\beforechapskip}{0pt}% was 50pt
\setlength{\midchapskip}{20pt}%
\setlength{\afterchapskip}{20pt}% was 40pt
\renewcommand*{\printchaptername}{}%
\renewcommand*{\chapnumfont}{\normalfont\sffamily\huge\bfseries}%
\renewcommand*{\printchapternum}{%
\flushright
\begin{tikzpicture}
\draw[fill,color=black] (0,0) rectangle (2cm,2cm);
\draw[color=white] (1cm,1cm) node { \chapnumfont\thechapter };
\end{tikzpicture}%
}%
\renewcommand*{\chaptitlefont}{\normalfont\sffamily\Huge\bfseries}%
\renewcommand*{\printchaptertitle}[1]{\flushright\chaptitlefont##1}%
}

\chapterstyle{box}
\begin{document}
\chapter{Fancy chapter with TikZ}
\blindtext
\end{document}


I used showframe to make apparent the bounding boxes of the various page parts.

• Thank you very much! You mentioned in the comments that the memoir class has much more features. I don't know much about it but: can I safely start using it for my project without missing features later on? Also, would there be significant upsides of using it or could I just as well stick to the report class? – texfan May 1 '15 at 10:21
• @texfan Don't worry about using memoir. You can use its advanced features, but you're not forced to. – egreg May 1 '15 at 10:26
• Thanks again. I think I will keep using the memoir class because in your answer it seems simpler to adjust the space fully to my liking. I will however accept Harish Kumar's answer because he answered the bonus question that I initially posed. I hope you understand :/. – texfan May 1 '15 at 10:35