0

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

enter image description here

\documentclass[12pt,a4paper]{report}

\usepackage{fancyhdr}
\pagestyle{fancy}

\rhead{\textbf{\thepage}}
\lhead{\textsl{\nouppercase{\leftmark}}}%
\setlength{\headheight}{14.5pt}

\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

enter image description here

  • 1
    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
2

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}

enter image description here

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}

enter image description here

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.

If you can improve my answer to a better one, your edit, or, rather, your answer will be high appreciated!

  • 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
  • @Student Yes! I am editing my answer. – JouleV Nov 20 '18 at 10:44
  • @Student I already edited my answer. – JouleV Nov 20 '18 at 10:55
  • Thank you very much. How can I reduce the height of the black rectangle or you think that the height is good? – Student Nov 20 '18 at 11:01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.