Text FormattingBoldfaced Chapter headings in ToC - Tocstyle pckg

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
bettinar
Posts: 2
Joined: Wed Dec 22, 2010 11:25 am

Boldfaced Chapter headings in ToC - Tocstyle pckg

Post by bettinar »

Dear everyone!

I want my ToC to look nice - I use the tocstyle package,
and it should typeset the headings of chapters sans serif
and bold faced in the ToC, as it does in the chapters
of the body of the text. In the ToC, headings are typeset sf, but not bold faced.
Maybe someone can look at my example, to help me where my mistake
lies?

Thanks so much,
Bettina.

Code: Select all

%--PREAMBLE--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[12pt,a4paper]{report}
\usepackage[top=2 cm, bottom=2 cm, left=4 cm, right=2 cm]{geometry}
\usepackage{setspace}
\onehalfspacing
\pagestyle{plain}				%pagenumbering on bottom

% \usepackage{fink}				INSTALL PACKAGE and activate for test prints, 
% \usepackage{scrpage2}			shows Latex file names etc
% \pagestyle{scrheadings}

\usepackage[T1]{fontenc}		%quotation marks european style
\usepackage{lmodern}			%latin modern fonts
\usepackage[american]{babel}	%specify the main language
\usepackage[utf8]{inputenc}

\addto\captionsamerican{		%exception for fixed names, using babel
  \renewcommand{\indexname}
    {Documentary Filmography}}

\hyphenation{ESoDoc} 			%no hyphenation, or specific hyphenation
\clubpenalty=10000				%eliminates widows+orphans (1000 suppresses them)
\widowpenalty=10000

\usepackage{sectsty} 			%section headlines ssf font	
\allsectionsfont{\sffamily}

\usepackage[tocgraduated]{tocstyle}
\usetocstyle{classic}{\bfseries}

\usepackage{pdfpages}			%include pdfs
\usepackage{graphicx} 			%include graphics in jpg,png or pdf format
\graphicspath{{images//}}		%folder called images in latexfile directory

\usepackage[left]{eurosym}		%include for Euro Symbol
\usepackage{url}					%include URLs with \url{urlhere}
\urlstyle{sf}					%sf font for URLs
\usepackage{paralist} 			%enable for using inline lists

\usepackage{tabularx}			%text-width tables

\usepackage[authoryear,round]{natbib}
\setcitestyle{aysep={},notesep={: }}
\bibliographystyle{agsm}

\setcounter{tocdepth}{3}			%ToC Level Depth

\usepackage{makeidx} 			%indexing
\makeindex
%\usepackage{showidx}			%activate for proof-reading

\usepackage{hyperref}

\begin{document}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\input{titlepage}

\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{Table of Contents}
\tableofcontents

\chapter{Chapter1}
This is the Chapter
\section{Section1}
This is the section


\end{document}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Last edited by bettinar on Wed Dec 22, 2010 9:05 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Boersma
Posts: 21
Joined: Mon Nov 22, 2010 9:29 pm

Boldfaced Chapter headings in ToC - Tocstyle pckg

Post by Boersma »

Hi Bettina,

You can use the package tocloft, have a look at an other post on LC.

A small MWE:

Code: Select all

\documentclass{report}
\usepackage{sectsty}								%section headlines ssf font   
\allsectionsfont{\sffamily}

\usepackage{tocloft}
\setcounter{tocdepth}{3}         					%ToC Level Depth
\renewcommand{\cftchapfont}{\bfseries}				%Bold chapterentries
\renewcommand{\cftsecfont}{\ttfamily}				%Typewriter sectionentries
\renewcommand{\cftsubsecfont}{\ttfamily \itshape}	%Italic typewriter sectionentries
%Or whatsoever

\begin{document}
\tableofcontents

\chapter{The first chapter}
This is the Chapter
\section{The first section}
This is the section
\subsection{First subsection}
Further sectioning

\end{document}
Don't forget to run it twice.

Regards, Boersma
bettinar
Posts: 2
Joined: Wed Dec 22, 2010 11:25 am

Re: Boldfaced Chapter headings in ToC - Tocstyle pckg

Post by bettinar »

Beautiful.
Thanks!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Boldfaced Chapter headings in ToC - Tocstyle pckg

Post by localghost »

Now that the problem is solved, please be so kind and mark the topic accordingly as clearly written in Section 3 of the Board Rules (to be read before posting). Please keep that in mind for the future so that further reminders will not be necessary.


Best regards and welcome to the board
Thorsten
Post Reply