Text FormattingManual Addition to the ToC

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Rustam
Posts: 22
Joined: Fri Nov 02, 2012 5:15 pm

Manual Addition to the ToC

Post by Rustam »

Here is the file :

Code: Select all

\documentclass[11pt,titlepage,draft]{report}
\parindent=0cm
\usepackage{amsmath, amsthm, amssymb,latexsym,amsfonts}
\usepackage{showkeys}

\newtheorem{theorem}{Theorem }[section]
  
\newtheorem{definition}[theorem]{Definition}
\newtheorem{corollary}[theorem]{Corollary}

\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{example}[theorem]{Example}
\newtheorem{remark}[theorem]{Remark}
\newtheorem*{comment}{Comment}
\newcommand{\ud}{\mathrm{d}}
\newcommand{\defeq}{\triangleq}

\numberwithin{equation}{section}

\begin{document}



\tableofcontents
\newpage
\abstract{aaa}

\chapter*{Notation Glossary}
aaaa

%\addcontentsline{toc}{chapter}{Notation Glossary}
\addtocontents{toc}{\bf{Notation Glossary}}


\chapter{Introduction}
bbbb
\chapter{Next}
aaa
\appendix
\chapter{A}
aaaaa

\end{document}
And TeXstudio gives me following error :

Code: Select all

! LaTeX Error: Something's wrong--perhaps a missing \item.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.2 ...e {chapter}{\numberline {1}Introduction}{3}
Here is the *.toc file:

Code: Select all

\bf {Notation Glossary}
\contentsline {chapter}{\numberline {1}Introduction}{3}
\contentsline {chapter}{\numberline {2}Next}{4}
\contentsline {chapter}{\numberline {A}A}{5}
What is wrong?

Thanks.
Last edited by localghost on Fri Nov 02, 2012 6:20 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.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Manual Addition to the ToC

Post by localghost »

You need to end the entry correspondingly.

Code: Select all

\addtocontents{toc}{\textbf{Notation Glossary}\par}
Since we are not working with LaTeX 2.09 any more, you should use the correct LaTeX2e syntax (see above).

Addendum:
If you do the glossary with a respective package, have look at its manual. Such packages mostly offer to add the glossary heading to the ToC.


Best regards and welcome to the board
Thorsten
Post Reply