2

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.

  • 2
    \subsection[subsection 1]{\Large subsection 1} should do it. However, this is not the way to change the font size of sections. Use sectsty or titlesec for such jobs. – user11232 Mar 16 '15 at 9:56
5

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}
  • Thank you, \usepackage{titlesec} works well in the simple code but not quite well with \clearpage in the full code. I tried \usepackage{sectsty} \sectionfont{\LARGE} \subsectionfont{\Large}, it works fine. – sibscc Mar 17 '15 at 5:39
  • @sibscc: If you like create a MWE showing the \clearpage problem. I use titlesec quite often and never had such an issue … To keep the TeX.SX clean it would be good to mark this question as answered, either by accepting my answer or posting a self-answer and accepting this one. – Tobi Mar 17 '15 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.