LaTex: Problem with ToC in article class

In summary, the article class with a table of contents works fine, but one point is that the list of figures, list of tables, and bibliography generate starred sections (i.e., section*). To get these items into the table of contents, you need to explicitly invoke a macro.
  • #1
Chaoticus
3
0
Hello,

I'm using the article class with a table of contents. Everything works fine, except one point:

The List of Figures, List of Tables and the Bibliography appars in the Contens with no points between the Name and the Page where they are.

For example:

Contents
1 Section 1
1.2 Subsection 1........ 2

2 Section 2
2.1 Subsection 2....... ..3

List of Figures4 List of Tables5


It works fine if I use the report class, but I'd prefer to use the article class. (Don't need chapters)

I tried to search the Net for a solution, but with no sucsess. Does anybody know what's wrong?
 
Physics news on Phys.org
  • #2
The list of figures, list of tables, and bibliography generate starred sections (i.e., section*). That means these things are not numbered and by default they do not get an entry in the table of contents. The only way for these items to get into the table of contents is if you explicitly invoking some macro to add them to the table of contents.

Which means you are doing something wrong in adding them to the toc. Perhaps a \contentsline instead of an \addcontentsline, etc.

Try the following:
Code:
% Add a \newpage if the list of figures is to be on its own page
\addcontentsline{toc}{section}{List of Figures}
\listoffigures

% Add a \newpage if the list of tables is to be on its own page
\addcontentsline{toc}{section}{List of Tables}
\listoftables

Do something similar for the bibliography after the main body.
 
  • #3
Thanks for your fast reply.

Actually, I'm using TecNic Center and a template provided there, so I'm using these commands you mentioned. Sorry, I forgot to write this in my first post.

This is the main Doc:

\begin{document}

\pagestyle{empty}

\title{Title}
\author{Autor}
%\date{}

\maketitle\tableofcontents
\cleardoublepage

\pagestyle{plain} %% Chapters %%%%%%%%%%%%%%%%%%%%%%%%
\input{Chapter1.tex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% BIBLIOGRAPHY AND OTHER LISTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\addtocontents{toc}{\protect\vspace*{\baselineskip}}\clearpage
\addcontentsline{toc}{chapter}{Bibliography} %'Bibliography' into toc
\bibliographystyle{chicago}
\bibliography{literature}

%% The List of Figures
\clearpage
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures

%% The List of Tables
\clearpage
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables
 
  • #4
Ah, I see the error.

I used {chapter} not {section} when adding the contents line.

Thanks for your help.
 
  • #5




Hi there,

I understand that you are experiencing an issue with the table of contents in your article class document. From your description, it seems that the issue lies in the formatting of the table of contents, specifically with the spacing between the names and page numbers for the List of Figures, List of Tables, and Bibliography.

It is possible that this is a formatting issue caused by the article class itself. The report class may have different formatting options for the table of contents, which is why it works fine in that class. One solution could be to manually adjust the spacing in your table of contents using the \setlength command. Another option could be to try using a different document class altogether, such as the book class, which also does not require chapters but may have different formatting options for the table of contents.

I would also recommend checking the documentation or forums for the article class to see if other users have encountered similar issues and if there are any known solutions. Additionally, you can try reaching out to the creators of the article class for further assistance.

I hope this helps and that you are able to resolve your issue. Best of luck with your document!
 

Related to LaTex: Problem with ToC in article class

1. What is LaTex?

LaTeX is a typesetting language used for creating professional-looking documents, particularly in the fields of mathematics, science, and academia.

2. What does "ToC" stand for in LaTex?

"ToC" stands for "Table of Contents". It is a feature in LaTex that automatically generates a list of all the sections and subsections in a document.

3. What is the "article" class in LaTex?

The "article" class is one of the document classes available in LaTex. It is used for creating short documents such as journal articles, reports, and letters.

4. What is the problem with ToC in the article class?

The problem with ToC in the article class is that it does not automatically include all sections and subsections by default. It only includes sections and subsections up to a certain depth, which can be adjusted using the \setcounter{tocdepth}{X} command, where X is the desired depth.

5. How can I fix the problem with ToC in the article class?

To fix the problem with ToC in the article class, you can use the \tableofcontents command to manually generate a ToC with all the sections and subsections. Alternatively, you can use the \setcounter{tocdepth}{X} command to adjust the depth of the automatically generated ToC. You can also use the \addcontentsline{toc}{section}{Section Name} command to manually add a section or subsection to the ToC.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
11K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
18K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
414
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
4K
Back
Top