in the code given below, because of the text that I chose to use, the box around the chapter header changes:
How can I keep the box around all the chapter headers at a fixed height and centered (vertically) in the box? Thanks for your help.
Here is the code:
\documentclass{book}
\usepackage{geometry}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{calc}
\usepackage[english]{babel}
\usepackage[explicit]{titlesec}
\usepackage{charter}
\usepackage[sc,osf]{mathpazo}
\usepackage{tikz}
\usetikzlibrary{calc,shadows.blur,shapes.symbols}
\definecolor{mybluei}{RGB}{28,138,207}
\definecolor{ocre}{RGB}{243,102,25}
\makeatletter
\renewcommand{\@chapapp}{Problem}
\makeatother
\makeatletter
\def\@makechapterhead#1{%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.north west)
{\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north west,inner sep=0pt] at (.2,0) {};
\draw[anchor=west] (\Gm@lmargin+0cm,-4.8cm) node { %
{\begin{tikzpicture}
\node[draw=none,shade,
top color=mybluei,
bottom color=mybluei,
rounded corners=6pt,
blur shadow={shadow blur steps=6}
]{\color{white}\fontsize{50}{120}\itshape\rmfamily\chaptertitlename \selectfont\thechapter};
\end{tikzpicture}}
};
\end{tikzpicture}};
\end{tikzpicture}
\else
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.north west)
{\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north west,inner sep=0pt] at (.2,0) {}
\draw[anchor=west] (\Gm@lmargin+1cm,-4.62cm) node { %
\parbox[b]{70pt}{\colorbox{mybluei}{%
\parbox[b][60pt][t]{44pt}{\centering%
\color{white}%
{\itshape\rmfamily\small\chaptertitlename}%
\vfill{\fontsize{50}{120}\selectfont\thechapter}%
}%
}%
}\hspace{15pt}%
\parbox[b]{\dimexpr\textwidth-150pt}{%
\raggedright\scshape#1\vskip6pt%
}%
};
\end{tikzpicture}};
\end{tikzpicture}
\fi\fi\par\vspace*{270\p@}\stepcounter{chapshift}}}
\makeatother
\pagestyle{plain}
\newcounter{chapshift}
\addtocounter{chapshift}{-1}
\newcommand\BoxColor{ocre!60}
\renewcommand\chaptermark[1]{\markboth{\thechapter.~#1}{}}
\usepackage{etoolbox,fancyhdr}
\begin{document}
\chapter{Problem 1}
\section{Paragraphs of Text}\index{Paragraphs of Text}
\lipsum[1]
\chapter{Problem 3}
\section{Paragraphs of Text Two}\index{Paragraphs of Text}
\lipsum[1]
\chapter{Problem 4}
\section{Paragraphs of Text Two}\index{Paragraphs of Text}
\lipsum[1]
\end{document}
\strut
.\strut
either just before or just after\chaptertitlename
. that may be a bit large; a slightly smaller alternative is\vphantom{()}
. (only one parenthesis is needed for the size, but i put in both to outsmart editors that implement "fence-matching".)