Text FormattingTOC not in bold, without numbers before the chapters

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ffarr
Posts: 28
Joined: Sat Apr 23, 2011 6:00 pm

TOC not in bold, without numbers before the chapters

Post by ffarr »

Hi,

how can I make my TOC not in bold, and how can I delete the numbers before the chapters?

e.g. now it's like this:

1 [bold Chapter name]...................... [page number]
[blank space] 1.1 [subsection name]........................ [page number]

I want it like this:

[Chapter name]...................... [page number]
[blank space][subsection name]........................ [page number]

Thank you!

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: TOC not in bold, without numbers before the chapters

Post by Stefan Kottwitz »

Which document class do you use?

Stefan
LaTeX.org admin
ffarr
Posts: 28
Joined: Sat Apr 23, 2011 6:00 pm

TOC not in bold, without numbers before the chapters

Post by ffarr »

Stefan_K wrote:Which document class do you use?

Stefan
book, here's my code:

Code: Select all

\documentclass[12pt,a4paper,twoside,italian]{book}
\usepackage[T1]{fontenc}
%\usepackage[urw-garamond]{mathdesign}
\usepackage{fourier}
\usepackage[italian]{babel}
\usepackage[latin1]{inputenc}
\usepackage[%
      papersize={120mm,195mm},
      left=18mm,
      right=18mm,
      bottom=20mm,
      top=25mm,
      headheight=14pt,
      includehead,
      nofoot,
    ]{geometry}
\usepackage{babel}
\usepackage[raggedright,pagestyles]{titlesec}% Add “clearempty” option if you need to get rid of headers/footers on empty pages
\usepackage{blindtext}
\usepackage{color}

\titleformat{\chapter}{\normalfont\large\bfseries}{}{0pt}{\Large}[\thispagestyle{plain}]
%%% Page styles

\makeatletter

\newpagestyle{toc}{% Create a page style for TOC
   \let\ps@plain\ps@empty% Redefine plain style which is automatically applied to the first page of TOC; put “empty”, or “main”, or any other page style you like
   \sethead[][][]{}{}{}
}

\newpagestyle{chapter}{% Create a page style for the first page of a chapter
   \setfoot[][\thepage][]{}{\thepage}{}
}

\newpagestyle{main}{%
   \let\ps@plain\ps@chapter% Activate page style for the first page of a chapter
   \sethead[\thepage][][\chaptertitle]{\chaptertitle}{}{\thepage}
   \headrule
}

\makeatother

%\newcommand{\cambiaFont}[2]{{\fontencoding{T1}\fontfamily{#1}%
%\selectfont#2}}

%\usepackage[T1]{fontenc}


\begin{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

TOC not in bold, without numbers before the chapters

Post by Stefan Kottwitz »

With the book class, try this in your document:

Code: Select all

\renewcommand*{\l@chapter}[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \vskip 1.0em \@plus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
      \penalty\@highpenalty
    \endgroup
  \fi}
This should produce non-bold entries. Regarding the numbers: Do you number chapters in the document body? If yes, I recommend to do it in the TOC too, the number just belongs to the chapter then.

Stefan
LaTeX.org admin
ffarr
Posts: 28
Joined: Sat Apr 23, 2011 6:00 pm

Re: TOC not in bold, without numbers before the chapters

Post by ffarr »

To remove numbering in the ToC i put

\renewcommand{\thechapter}{}
\renewcommand{\thesection}{}

It works. I don't mind to have it in the text.

Now I just need it not bold..
Post Reply