[Tex/LaTex] Upper case chapter titles Tocstyle

koma-scripttoclofttocstyle

I would like to make table of contents in Tocstyle (standard package). Here is my code.

        \documentclass[fontsize=12pt]{scrreprt}
\usepackage{tocstyle}
\usetocstyle{standard}


\addtokomafont{disposition}{\rmfamily}

\usepackage{titlesec}
\usepackage{setspace}
\usepackage{tocloft}

  \renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand \thesection{\arabic{chapter}.\arabic{section}}
\renewcommand \thesubsection{\arabic{chapter}.\arabic{section}.\arabic{subsection}}

\titleformat{\chapter}[display] {\singlespacing\rmfamily\fontsize{16pt}{19pt}\bfseries}
{\MakeUppercase{\chaptertitlename\ \thechapter}\filcenter}{10pt}{\centering\uppercase}
{\fontsize{14pt}{16pt}\filcenter}   



\begin{document}
\tableofcontents
\newpage
\chapter{Test}
\section{Test}
\chapter{Test}
\section{Test}
\chapter{Test}
\section{Test}

\end{document}

and I cannot use the following code with Tocstyle.

\renewcommand{\cftchapfont}{\bfseries\uppercase}

I would like to make a title of contents with all capital letters like "TEST".enter image description here

Best Answer

You can define an uppercase style, similar to the definitions used by standard, but including \MakeUppercase (\uppercase in case hyperref is loaded):

\documentclass[fontsize=12pt]{scrreprt}
\usepackage{tocstyle}

\makeatletter
\newtocstyle{uppercase}{%
  \settocfeature{dothook}{\normalfont}%
  \settocfeature[0]{entryhook}{\bfseries\MakeUppercase}
  \settocfeature[1]{entryhook}{\MakeUppercase}%
  \settocfeature[2]{entryhook}{\MakeUppercase}%
  \settocfeature[-1]{entryvskip}{2.25em plus 1pt}%
  \settocfeature[-1]{leaders}{\hfill}%
  \settocfeature[0]{entryvskip}{1em plus 1pt}%
  \settocfeature[0]{leaders}{\hfill}%
  \iftochaschapter\else
    \settocfeature[1]{entryvskip}{1em plus 1pt}%
    \settocfeature[1]{leaders}{\hfill}%
    \settocfeature[1]{entryhook}{%
      \begingroup
        \edef\@tempa{toc}%
        \ifx\tocstyleAliasTOC\@tempa\aftergroup\bfseries\fi
      \endgroup
    }%
  \fi
}
\makeatother
\usetocstyle{uppercase}

\addtokomafont{disposition}{\rmfamily}

\usepackage{titlesec}
\usepackage{setspace}

\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand \thesection{\arabic{chapter}.\arabic{section}}
\renewcommand \thesubsection{\arabic{chapter}.\arabic{section}.\arabic{subsection}}

\titleformat{\chapter}[display] {\singlespacing\rmfamily\fontsize{16pt}{19pt}\bfseries}
{\MakeUppercase{\chaptertitlename\ \thechapter}\filcenter}{10pt}{\centering\uppercase}
{\fontsize{14pt}{16pt}\filcenter}   

\begin{document}
\tableofcontents
\newpage
\chapter{Test}
\section{Test}
\subsection{Test}
\chapter{Test}
\section{Test}
\chapter{Test}
\section{Test}

\end{document}

enter image description here

By the way,using titlesec with KOMA classes might not be the best option; see Incompatibilities between KOMA-Script and titlesec.

I know that perhaps you are dealing with a Faculty requirement for your thesis, but having titles and ToC entries in upper case is not the best typographical choice; at this respect, the KOMA documentation says (referring to headers, but the same can be applied to other elements):

Unfortunately LaTeX's command for upper case letter typesetting, \MakeUppercase results in an very inadequate typesetting, because it neither uses letter spacing nor does it space balancing. One reason for this behaviour might be, that a glyph analyzing would be needed, to incorporate the letter shapes and their combination while space balancing. Because of this KOMA-Script author suggests to abstain from upper case letter typesetting for running heads.