6

I am overriding the default section titles for a large document. This consists of adding words such as "Section", and using alpha or roman numbers.

However, the table of contents is continuing to use the arabic numerals and is surpresing the added descriptions. Is it possible to have the TOC update with the titles, as displayed?

\documentclass{article}
\usepackage[explicit]{titlesec}

\titleformat{\section}{} {} {0pt} {Section \Alph{section}. #1}
\begin{document}
    \tableofcontents
    \section{Intro}
        123
\end{document}
1
  • You should use \renewcommand\thesection{Alphsection} and write {Section \thesection}} in \titleformat. If you also want to have ‘Section’ to appear in the table of contents, you should use the companion titletoc package.
    – Bernard
    Commented Nov 14, 2014 at 0:01

1 Answer 1

6

Something like this, perhaps:

\documentclass{article}
\usepackage[explicit]{titlesec}
\usepackage{titletoc}
\renewcommand*\thesection{\Alph{section}}
\newcommand*\Sectionname{Section}

\titleformat{\section}{\normalfont\normalsize}{\Sectionname\ \thesection.\quad}{0pt}{#1}
\titlecontents*{section}[0pt]{\normalfont\normalsize}{\Sectionname\ \thecontentslabel.\quad}{}{}


\begin{document}
    \tableofcontents
    \section{Intro}
        123
\end{document}

sections in ToC

EDIT

If you would like the ToC entry to be upper case, you could use

\titlecontents*{section}[0pt]{\normalfont\normalsize}{\MakeUppercase{\Sectionname} \thecontentslabel.\quad\uppercase}{}{}

This makes both the section name and the section title upper case. If you just want one or the other, change that part back to the original code above.

2
  • Thank you very much \titlecontents was exactly what I was looking for. Side question, is there a command to make the TOC entry uppercase? Similar to \scshape
    – DBordello
    Commented Nov 14, 2014 at 18:41
  • @DBordello You are welcome. Please see edited answer above.
    – cfr
    Commented Nov 14, 2014 at 21:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .