2

Please consider the following code, I will then explain what I tried to achieve in it and how I failed:

\documentclass[a4,12pt] {article}

\usepackage[margin=1in]{geometry}
\usepackage{indentfirst} 

\usepackage{tocloft}
\renewcommand\cftsecfont{\large}
\renewcommand\cftsubsecfont{\large}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} 
\fancyhead[L]{TITLE IN CAPITAL LETTERS}
\renewcommand{\headrulewidth}{0pt}

\fancypagestyle{firstpage}
{
  \lhead{Running head: TITLE IN CAPITAL LETTERS}
  \renewcommand{\headrulewidth}{0pt}
}


\begin{document}

\thispagestyle{firstpage}

\vspace*{\fill}
\begingroup
\centering

Cover page stuff here

\endgroup
\vspace*{\fill}


\newpage
{\normalsize \tableofcontents}


\newpage
\section{Introduction}
Intro goes here

\section{Section 1}
Section 1 stuff here.

\section{\large{Section 2 (Which I am controlling the font size of)}}
Section 2 stuff here.

\section{Section 3}
Section 3 stuff here

\section{Summary}
The summary summarizes


\end{document}
  1. To have a header on the first page that says "Running head: TITLE IN CAPITAL LETTERS" and have the rest of pages with the header "TITLE IN CAPITAL LETTERS," I used the following lines of the code: (10 to 20) and line 25. Courtesy of:

  2. I noticed that when I chose a different font for section 2, this also affects the size in the table of content! The solution I found was to use the package \usepackage{tocloft} which allows you to choose the font size and style of everything in the TOC. How to change font size in table of contents? So that's what lines 6 to 8 are for.

Now, it's all perfect, however, I noticed that, for some reason, the title "TITLE IN CAPITAL LETTERS" does NOT show up in the header of the page of the TOC!

Through testing, I now know it's because of the package \usepackage{tocloft}, because if I remove it, the header re-appears in the page of the TOC.

How can I solve this problem? Perhaps there is a better way of unifying the font size in the TOC without using the package \usepackage{tocloft}?

Tiuri
  • 7,749
Aziz
  • 159

2 Answers2

4

You can specify two versions of the section title, one for the actual title and one for display in the table of contents, by using the optional arguments as well, \section[Title for TOC]{Title}.

This means for your example that you don't need to add the tocloft package, but can just define the optional argument without the \large macro.

Full example:

\documentclass[a4paper,12pt] {article}

\usepackage[margin=1in]{geometry}
\usepackage{indentfirst}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} 
\fancyhead[L]{TITLE IN CAPITAL LETTERS}
\renewcommand{\headrulewidth}{0pt}

\fancypagestyle{firstpage}
{
  \lhead{Running head: TITLE IN CAPITAL LETTERS}
  \renewcommand{\headrulewidth}{0pt}
}


\begin{document}

\thispagestyle{firstpage}

\vspace*{\fill}
\begingroup
\centering

Cover page stuff here

\endgroup
\vspace*{\fill}


\newpage
{\normalsize \tableofcontents}


\newpage
\section{Introduction}
Intro goes here

\section{Section 1}
Section 1 stuff here.

\section[Section 2]{\large{Section 2 (Which I am controlling the font size of)}}
Section 2 stuff here.

\section{Section 3}
Section 3 stuff here

\section{Summary}
The summary summarizes


\end{document}

enter image description here

enter image description here

Tiuri
  • 7,749
1

You should use the titles option to tocloft.

\usepackage[titles]{tocloft}

and no need to change anything else in your MWE.

Peter Wilson
  • 28,066