I am using the university thesis template which has the chapter/section headings setup in a way that prevents using hyperref. The problem is they use \setcounter{secnumdepth}{0} so there is no section number preceding the chapter/section title. They want the heading to display using this format both in the TOC and at the beginning of the chapter:

Chapter 1: Sample Chapter Heading

The way they implement this means we must manually number the chapters and it also breaks hyperref.

Here is a MWE:


\renewcommand{\contentsname}{\centerline {\normalsize Table of Contents}}

% this breaks their chapter/toc settings
% \usepackage[hidelinks]{hyperref}


%\section{\protect \centering Chapter 7: Sample Title}
\section{\protect Chapter 7: Sample Title}
chapter text goes here

I am sure latex has the ability to create chapter/section heading in this format while using counters but I am struggling to get it to work. How can I use the built in counters (preferably the section counter since each section is a chapter in their setup) to natively create this format of the table of contents which would also allow the use of hyperref?

EDIT 1: I did find that the \centering flag in the section titles was conflicting with hyperref. Following these two responses (thanks @GonzaloMedina), I was able to implement the centering and the desired font size using the following


in the preamble which allowed me to remove the \centering flag from the section title:

%\section{\protect \centering Chapter 7: Sample Title}
\section{\protect Chapter 7: Sample Title}

I added these modifications (commenting out the original) in the MWE.

toc image

  • 1
    I'm not exactly sure what your question is. You can use hyperref by removing \protect \centering. To get the right chapter labels, use \renewcommand\thesection{Chapter \arabic{section}:} – alaferg Jun 2 '15 at 17:21
  • @alaferg, \renewcommand\thesection{Chapter \arabic{section}:} was exactly what I needed. Thank you! (can you add that as an answer so I can accept that?) – Steven C. Howell Jun 2 '15 at 18:07
  • sure, no prob :) – alaferg Jun 3 '15 at 19:40

To get the right chapter labels, use

\renewcommand\thesection{Chapter \arabic{section}:}

EDIT @Werner makes an excellent point. Here's a better approach (may need to play around with the spacing) which won't mess up your labels and references. To change TOC appearance

\renewcommand{\cftsecpresnum}{Chapter }

To change section heading inside doc

\titleformat{\section}{\bfseries\Large}{Chapter \arabic{section}:}{0.5em}{}
  • 2
    Hmmm, this will also affect reference made to chapters, not just the labels in the ToC. So, See \ref{ch:label}. will turn into See Chapter 2:., say... not really ideal. – Werner Jun 3 '15 at 20:28
  • I think, this should edited and improved – user31729 Jun 3 '15 at 20:29

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.