I'd like to change the font in the colorbox, i.e. the font for the chapter number, e.g. with \changefont{phv}{b}{n} but unfortunately when I add this command the size of the color box changes, too. Is there a way to prevent this form happening?
\documentclass[ fontsize=12pt,
a4paper,
numbers=noenddot,
headings=big]
{scrreprt}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\newcommand{\changefont}[3]{
\fontfamily{#1} \fontseries{#2} \fontshape{#3} \selectfont}
\usepackage{color}
%\usepackage{blindtext}
\usepackage[minionint,mathlf]{MinionPro}
\renewcommand{\sfdefault}{Myriad-LF}
% Define own Chapter style
% Pretty chapter pages
%------------------------------------------
\usepackage{soul}
\usepackage{pdfpages}
\usepackage{etoolbox}
\makeatletter
\newsavebox{\feline@chapter}
\newcommand\feline@chapter@marker[1][4cm]{%
\sbox\feline@chapter{%
\resizebox{!}{#1}{\fboxsep=0pt%
\colorbox{red}{\color{black}\bfseries\sffamily\thechapter}% %--> \changefont{phv}{b}{n}
}}%
\rotatebox{90}{%
\resizebox{%
\heightof{\usebox{\feline@chapter}}+\depthof{\usebox{\feline@chapter}}}%
{!}{\scshape\so\@chapapp}}\hspace{.4mm}%
\raisebox{\depthof{\usebox{\feline@chapter}}}{\usebox{\feline@chapter}}%
}
\newcommand\feline@chm[1][4cm]{%
\sbox\feline@chapter{\feline@chapter@marker[#1]}%
\makebox[0pt][l]{% aka \rlap
\makebox[1.07cm][r]{\usebox\feline@chapter}%
}}
\renewcommand*{\chapterformat}{%
\hspace{\leftmargin} \feline@chm[2.5cm] % Height of the colored box
\hspace{1.0cm}
}
\patchcmd{\@@makechapterhead}
{\size@chapter{#1}}
{\size@chapter{\parbox[b]{\dimexpr\textwidth-2.8cm\relax}{\raggedright#1}}}
{}
{}
\makeatother
%------------------------------------------
\begin{document}
\chapter{Lorem ipsum dolor sit amet, consectetuer adipiscing elit}
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
\end{document}
Best Answer
I have some problems compiling your document because of the
MinionPro
package.But, your problem is caused by the spaces inside
\changefont
. Replacing\changefont{phv}{b}{n}
by\fontfamily{phv}\bfseries
works for me:Alternatively, define your
\changefont
macro without spaces: