I am using a template to write up a proposal. The only issue is when I try to have a table of Contents, it comes up numbered with a zero.

\setsansfont{Roboto Condensed}


  \colorbox{blue!20}{\parbox{\dimexpr\textwidth-2\fboxsep}{\thesection\ #1}}}


    \textbf{Research Proposal}

    Project: ?


    \textbf{Bla bla }


    James Bond


    \Large  A research initiative in collaboration with the .... \\






\section{Preliminary title}

Text ....

\section{Scientific Interest}

More text.

\section{Main Research Question(s)}

More text.  Cite an example \cite[]{sample_ref}


\section{Research Methodology}


\section{Practical Relevance}

\section{Work Plan for Three Years}
\subsection{First Year}
\subsection{Second Year}
\subsection{Third Year}
\section{Education of the PhD Candidate}

  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Johannes_B Apr 21 '14 at 11:24
  • Your titleformat calls colorsection in which the numbering is defined. – Johannes_B Apr 21 '14 at 11:32

The problem is that \colorsection always typesets the value for the counter; one way to prevent this is to use two \titleformats one for the numbered sections and another one with the numberless option to typeset the title for unnumbered sections; the decision is made using a conditional; something along these lines:



  \colorbox{blue!20}{\parbox{\dimexpr\textwidth-2\fboxsep}{\ifnumbered\thesection\ \relax\fi#1}}}


\section{Test numbered section}
\section*{Test unnumbered section}
\section{Another test numbered section}


enter image description here

With the current definition of \colorsection, the presence/absence of descendants in the title might produce inconsistent heights for the color boxes; adding \struts might prevent this:

  \colorbox{blue!20}{\parbox{\dimexpr\textwidth-2\fboxsep}{\ifnumbered\thesection\ \relax\fi\strut#1\strut}}}

I suppressed from my example code all information from the original question that was not relevant to the issued at hand and changed to the article document class, since I don't have proposal; the solution, however, should work with the original settings.


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.