[Tex/LaTex] Change the font size in ToC

fontsizetable of contents

Here is my problem:

\documentclass{article}
\renewcommand{\thesubsection}{\arabic{subsection}}
\begin{document}
    \tableofcontents
    \section*{\LARGE Section 1}
    \addcontentsline{toc}{section}{Section 1}
    \section*{\LARGE Section 2}
    \addcontentsline{toc}{section}{Section 2}
    \subsection{\Large subsection 1}
    \subsection{\Large subsection 2}
\end{document}

As we can see, the size of subsections in toc is \Large. I want to change it to \normalsize without changing the size in the main text.
I tried:

\usepackage{tocloft}
\renewcommand\cftsubsecfont{\normalsize}

but it does not work.

Any hint will be thankful.

Best Answer

It seems like you don’t want to change the font size in the TOC but the one in you document. It is no good idea to “hard code” the style you want tu use in the argument of \section. It is much better to use a package such as title sec that allows you to change the format of headings globally. In you case it would be

\documentclass{article}

\usepackage{titlesec}

\titleformat*{\section}{\Large}

\begin{document}
\tableofcontents
\section{Demo}
\end{document}

This will apply the font setting \Large to all section headings but not their representation in the TOC.

If you use a KOMA-Script class you can use the build-in font changing commands:

\documentclass{scrartcl}

\setkomafont{section}{\Large}
   % add \rmfamily\mdseries to reset the default,
   % which is save in the font-element disposition,
   % e.g. \setkomafont{disposition}{\rmfamily}
   % will affect all levels of headings

\begin{document}
\tableofcontents
\section{Demo}
\end{document}