I am trying to get a fancy style for my report, and I found one online here
I used it for another report, but not exactly with the same code. I wanted to play around with it, change things, and started to realize that I altered it so much last time (a too long time ago), that I couldn't use it anymore.
Now, on a new computer, with a new project, I want to start with a fresh style, and I would like to play around with the element of the style.
The only trouble is that, first I can get it to work like on the example (n°39) : I don't get the black box. And second, I don't really understand the code.
That's why I'm seeking for your wisdom, to translate this bit of code so that I can use it.
Here is my code :
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[top=2cm, bottom=2cm, left=1.5cm, right=1.5cm]{geometry}
\usepackage{fancyhdr} % En-têtes et pieds de page
\usepackage{psboxit,pstricks}
\makeatletter
\renewcommand\part{%
\thispagestyle{fancy}%
\if@twocolumn
\onecolumn
\@tempswatrue
\else
\@tempswafalse
\fi
\null\vfil
\secdef\@part\@spart}
\renewcommand\chapter{
\thispagestyle{fancy}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%% THE PART I DON'T UNDERSTAND
\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}
\def\@makechapterhead#1{%
\reset@font
\parindent \z@
\vspace*{10\p@}%
\hbox{%
\vbox{%
\hsize=2cm%
\begin{tabular}{c}
\scshape \strut \@chapapp{} \\
\psboxit{box 0 0 0 black fill}{%
\vrule depth 8em width 0pt%
\vrule height 0pt depth 0pt width 10pt%
{\white \LARGE \bfseries
\strut \vrule height 1em depth 0pt width 0pt
\thechapter}%
\vrule height 0pt depth 0pt width 10pt%
}
\end{tabular}%
}%
\vbox{%
\advance\hsize by -2cm
\hrule height 0.4pt depth 0pt width \hsize
\par
\vskip 6pt%
\hspace{20pt}%
\parbox{260pt}{%
\Huge \bfseries #1}%
}%
}%
\vskip 100\p@
}
\def\@makeschapterhead#1{%
\reset@font
\parindent \z@
\vspace*{10\p@}%
\hbox{%
\vbox{%
\hsize=2cm%
\begin{tabular}{c}
\scshape \strut \phantom{\@chapapp{}} \\
\psboxit{box 0 0 0 black fill}{%
\vrule depth 8em width 0pt%
\vrule height 0pt depth 0pt width 10pt%
{\white \LARGE \bfseries
\strut \vrule height 1em depth 0pt width 0pt
\vphantom{\thechapter}}%
\vrule height 0pt depth 0pt width 10pt%
}
\end{tabular}%
}%
\vbox{%
\advance\hsize by -2cm
\hrule height 0.4pt depth 0pt width \hsize
\par
\vskip 6pt%
\hspace{20pt}%
\parbox{260pt}{%
\Huge \bfseries #1}%
}%
}%
\vskip 100\p@
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\pagenumbering{gobble}
\chapter*{Test}
\newpage
\chapter{Nice Chapter}
\newpage
\pagenumbering{arabic}
\pagestyle{fancy}
\lhead{Nice header}
\rfoot{Page\ \thepage}
\cfoot{}
\chapter{Test2}
\newpage
\chapter*{Nice Chapter2}
\end{document}
Initial Output :
EDIT :
As mentioned by Christian Hupfer, my code does not work properly maybe because of the age of the packages psboxit and psboxtricks
here the code with the one I previously used, but that I modified without really understanding it :
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[top=2cm, bottom=2cm, left=1.5cm, right=1.5cm]{geometry}
\usepackage{fancyhdr} % En-têtes et pieds de page
\usepackage[usenames,dvipsnames]{xcolor}
\makeatletter
\renewcommand\part{%
\thispagestyle{fancy}%
\if@twocolumn
\onecolumn
\@tempswatrue
\else
\@tempswafalse
\fi
\null\vfil
\secdef\@part\@spart}
\renewcommand\chapter{
\thispagestyle{fancy}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}
\def\@makechapterhead#1{%
\reset@font
\vspace*{-40\p@}%
\hbox{%
\vbox{%
\hsize=1cm%
\begin{tabular}{c}
\hspace*{-100mm} \scshape \strut \phantom{\@chapapp{}} \\
\hspace*{-9mm} \colorbox{Black}{\vbox{\hbox{\vbox to 1mm{}}\hbox{\color{white} \LARGE \bfseries \hspace{1mm}\thechapter\hspace{1mm}}\hbox{\vbox to 1cm{}}}}%
\end{tabular}%
}%
\vbox{%
\advance\hsize by -1cm
\hrule height 0.4pt depth 0pt width \hsize
\par
\vskip 6pt%
\hspace{1pt}%
\parbox{400pt}{%
\Huge \bfseries #1}%
}%
}%
\vskip 15\p@
}
\def\@makeschapterhead#1{%
\reset@font
\vspace*{-40\p@}
\hbox{%
\vbox{%
\hsize=1cm%
\begin{tabular}{c}
\hspace*{-100mm} \scshape \strut \phantom{\@chapapp{}} \\
\hspace*{-9mm} \colorbox{Black}{\vbox{\hbox{\vbox to 1mm{}}\hbox{\color{white} \LARGE \bfseries \hspace{1mm}\phantom{\thechapter}\hspace{1mm}}\hbox{\vbox to 1cm{}}}}%
\end{tabular}%
}%
\vbox{%
\advance\hsize by -1cm
\hrule height 0.4pt depth 0pt width \hsize
\par
\vskip 6pt%
\hspace{1pt}%
\parbox{400pt}{%
\Huge \bfseries #1}%
}%
}%
\vskip 15\p@
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\pagenumbering{gobble}
\chapter*{Test}
\newpage
\chapter{Nice Chapter}
\newpage
\pagenumbering{arabic}
\pagestyle{fancy}
\lhead{Nice header}
\rfoot{Page\ \thepage}
\cfoot{}
\chapter{Test2}
\newpage
\chapter*{Nice Chapter2}
\end{document}
psboxit
is an old package that apparently belongs tolatex2.09
. I am not sure this should be used nowadays.psboxit
is available on CTAN, but not on TeXLive for exampletitlesec
is close to what you want.