[Tex/LaTex] Changing font in colorbox


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,

\fontfamily{#1} \fontseries{#2} \fontshape{#3} \selectfont}



% Define own Chapter style
% Pretty chapter pages

\colorbox{red}{\color{black}\bfseries\sffamily\thechapter}% %--> \changefont{phv}{b}{n}
\makebox[0pt][l]{% aka \rlap

\hspace{\leftmargin} \feline@chm[2.5cm] % Height of the colored box




\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.

enter image description here

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:

Related Question