# Question related to chapter styles

I want to obtain the style of my chapters like the following:

\documentclass[12pt,a4paper]{report}

\usepackage{fancyhdr}
\pagestyle{fancy}

\begin{document}

\chapter*{Thanks}
\chapter{Chapter one}

\begin{thebibliography}{999}
\newpage
\bibitem{axlupol}{O. Axelsson, H. Lu, B. Polman,} {On the numerical radius of matrices and its application to iterative solution methods,} Linear Multilinear Algebra 37 (1994) 225-238.
\end{thebibliography}

\end{document}


My goal is to obtain

• Template #39 of LaTeX examples. – JouleV Nov 20 '18 at 8:46
• @DũngVũ It doen't compilate. – Student Nov 20 '18 at 8:51
• I'm sorry for the incompilablity. I usually use that site to have my chapters designed, but I haven't tried that template. I'm finding some other ways. – JouleV Nov 20 '18 at 9:45

An attempt using TikZ:

\documentclass{report}
\usepackage[margin=3cm]{geometry}
\usepackage[explicit]{titlesec}
\usepackage{tikz}
\usetikzlibrary{positioning}
\titleformat{\chapter}{}{}{0pt}{
\begin{tikzpicture}
\fill[black] (-0.7,-2) rectangle (0.7,2);
\draw[color=white] (0,1) node {\bfseries\Huge\thechapter};
\draw (0,2.5) node {\Large Chapter};
\draw (1,0)--(13,0);
\coordinate (start) at (1,0);
\node[below right=5mm and 0cm of start.center] {\bfseries\Huge #1};
\end{tikzpicture}
}
\begin{document}
\chapter{Introduction}
\end{document}


You should not use \chapter*{} as it doesn't work! Instead, try this code:

\documentclass{report}
\usepackage[margin=3cm]{geometry}
\usepackage[explicit]{titlesec}
\usepackage{tikz}
\usetikzlibrary{positioning}
\titleformat{\chapter}{}{}{0pt}{
\begin{tikzpicture}
\fill[black] (-0.7,-1.5) rectangle (0.7,1.5);
% Change to \fill (-0.7,-2) rectangle (0.7,2); if you want the black rectangle to be longer
\draw[color=white] (0,0.5) node {\bfseries\Huge\thechapter};
% Change to (0,1) if the black rectangle is changed in \fill
\draw (0,2) node {\Large Chapter};
% Change to (0,2.5) if the black rectangle is changed in \fill
\draw (1,0)--(13,0);
\coordinate (start) at (1,0);
\node[below right=5mm and 0cm of start.center] {\bfseries\Huge #1};
\end{tikzpicture}
}
\begin{document}
\chapter{Introduction}
\newpage
\begin{tikzpicture}
\fill[black] (-0.7,-1.5) rectangle (0.7,1.5);
% Change to \fill (-0.7,-2) rectangle (0.7,2); if you want the black rectangle to be longer
\draw (1,0)--(13,0);
\coordinate (start) at (1,0);
\node[below right=5mm and 0cm of start.center] {\bfseries\Huge Thanks!};
\end{tikzpicture}
\end{document}


Though you will add a piece of code which is not so short, but I think it is Ok. Because when the \chapter is defined in this way, \thechapter is placed in the TikZ picture, so \chapter* loses its own function.

• Thank you for the answer. If for axample I want to write \chapter*{Introduction} and I want that the number of chapter doen't appear, how can I do? – Student Nov 20 '18 at 10:27
• @Student How will the chapter look like if you use \chapter*? I think the chapter would look bad if there isn't the number. – JouleV Nov 20 '18 at 10:29