Format in toc appearing differently

I set up my toc to show parts in bold small caps, and then use a similar setup to show the beginning of references (such as bibliography and lists of figures etc.) and appendices. In the MWE, I use the same command (\addpart) for the two 'parts' Refefrences and Appendices, but only References is formatted as it should be. I cannot make Appendices be written in small caps and bold. Even when modifying the text directly locally, I can at most make it small caps, not in any way bold. Can anyone tell me how to do this?

Note: Before the Appendices in the actual document, I have a page like the one introducing parts, but not enumerated. It does not seem to influence the problem, as I cannot change the format of Appendices in the toc when this is not there, either. But if someone would come up with any solutions that influence this, you should know.

Most of the code is slightly modified versions of something that someone else were suggested here (I cannot find it now to give the writers credit...).

I use MiKTeX 2.7 for LaTeX

\documentclass[a4paper, 11pt, english]{report}
\usepackage{fontenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{tocloft}
\usepackage{geometry, fancyhdr, fix-cm}

% Modifies chapters to appear like sections under parts that are added to the toc (a modified version of )
\makeatletter
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >-2\relax
\refstepcounter{part}%
Part \thepart: \textsc{#1}}%
\else
\fi
\markboth{}{}%
{\centering
\interlinepenalty \@M
\normalfont
\ifnum \c@secnumdepth >-2\relax
\huge\bfseries \partname\nobreakspace\thepart
\par
\vskip 20\p@
\fi
\Huge \bfseries \textsc{#2}\par}%
\@endpart}
\def\@endpart{%
\thispagestyle{empty}%
\vfil\newpage
\if@twoside
\if@openright
\null
\thispagestyle{empty}%
\newpage
\fi
\fi
\if@tempswa
\twocolumn
\fi}
\makeatother

%Adds a ''part'' to the toc that is not numbered and does not have a page in the document
\phantomsection
\setlength{\cftbeforechapskip}{\cftbeforesecskip}
\setlength{\cftchapindent}{\cftsecindent}
\protect\renewcommand{\cftchapfont}{\cftsecfont}
\protect\renewcommand{\protect\cftchapdotsep}{\cftsecdotsep}
}
}

\begin{document}
\selectlanguage{english}
\input{toc}

\newpage
\part{First part}
\chapter{Chapter 1}
\newpage
\chapter*{Lists}

\clearpage

\part*{\textsc{Appendices}}
%\newpage
\appendix
\chapter{First appendix}

\end{document}


-

The problem is with the line

\protect\renewcommand{\cftchapfont}{\cftsecfont}


which, since you are writing to the .toc file defines the "value" of \cftchapfont to the value of \cftsecfont. This causes the .toc file to contain

\renewcommand {\bfseries }{\normalfont }


So after incorporating the table of contents, all incantations to the "bold face" series becomes normal. I am not quite sure what you intended to do with your various incantations, but you probably also want to \protect\cftchapfont in the line I quoted above. (And likely similarly with the \setlength commands and their first arguments...)

But principally, I am quite confused as why you are passing all those formatting commands inside an \addtocontents; surely the whole point of loading tocloft is so you can configure the appearances without writing strange incantations into the .toc file?

It would be much cleaner if you replaced the definition of \addpart by

\newcommand{\addpart}[1]{
\phantomsection
}


and separately invoke the formatting commands

\setlength{\cftbeforechapskip}{\cftbeforesecskip}
\setlength{\cftchapindent}{\cftsecindent}
\renewcommand{\cftchapfont}{\cftsecfont}
\renewcommand{\cftchapdotsep}{\cftsecdotsep}


which would compile to

-
Good reply: solved my specific problem and taught me something general I would not have figured out myself. Thanks –  Camilla Jun 10 '13 at 12:55