[Tex/LaTex] Font in ToC entries

fontstable of contentstocloft

I used

{\sffamily\tableofcontents}

to change the font from Times New Roman to sans serif in my table of contents. Then I used

\usepackage{tocloft}
\renewcommand\cftchapafterpnum{\vskip6pt}
\renewcommand\cftsecafterpnum{\vskip6pt}
\renewcommand\cftsubsecafterpnum{\vskip6pt}

in preamble to increase the space between ToC entries. But I found that all the entries in ToC (except chapter name) changed back to Times New Roman. How can I fix this. A MWE is given below:

\documentclass[fleqn, a4paper, 11pt, oneside]{book}
\pagestyle{plain}
\renewcommand{\rmdefault}{ptm}

\usepackage{tocloft}                  
\renewcommand\cftchapafterpnum{\vskip6pt}
\renewcommand\cftsecafterpnum{\vskip6pt}
\renewcommand\cftsubsecafterpnum{\vskip6pt}

\usepackage{newtxtext}

\begin{document}

{\sffamily\tableofcontents}

\chapter{QWERTYUIOP}              
\section{XYZXYZXYZXYZ}
\chapter{QWERTYUIOP}              
\section{XYZXYZXYZXYZ}
\chapter{QWERTYUIOP}              
\section{XYZXYZXYZXYZ}
\chapter{QWERTYUIOP}              
\section{XYZXYZXYZXYZ}
\subsection{xyxyzxyzxyzxyz}

\end{document}

Best Answer

When using tocloft, you have to set the fonts for each sectional component separately. There is no over-arching font setting, since each component is placed inside a box or group with their own font-specification. It allows the ultimate specificity, even though it might not suit your generic needs:

enter image description here

\documentclass{book}
\usepackage{mathptmx}

\usepackage{tocloft}
\renewcommand\cftchapafterpnum{\vskip6pt}
\renewcommand\cftsecafterpnum{\vskip6pt}
\renewcommand\cftsubsecafterpnum{\vskip6pt}

% Adjust sectional unit title fonts in ToC
\renewcommand{\cftchapfont}{\sffamily}
\renewcommand{\cftsecfont}{\sffamily}
\renewcommand{\cftsubsecfont}{\sffamily}

\usepackage{newtxtext}

\begin{document}

\tableofcontents

\chapter{QWERTYUIOP}
\section{XYZXYZXYZXYZ}
\chapter{QWERTYUIOP}
\section{XYZXYZXYZXYZ}
\chapter{QWERTYUIOP}
\section{XYZXYZXYZXYZ}
\chapter{QWERTYUIOP}
\section{XYZXYZXYZXYZ}
\subsection{xyxyzxyzxyzxyz}

\end{document}

Note that you'll have to set the page number fonts as well. This requires

\renewcommand{\cftchappagefont}{\sffamily}
\renewcommand{\cftsecpagefont}{\sffamily}
\renewcommand{\cftsubsecpagefont}{\sffamily}