4

I have the following code, the problem is that table of contents is not working, it does not use section titles as it should instead there is only a "Contents" title. How to fix that?

\documentclass[a4paper, 12pt]{article} 

\usepackage[protrusion=true,expansion=true]{microtype} 
\usepackage{graphicx}
\usepackage{wrapfig} 
\usepackage[margin=0.98in]{geometry}
\usepackage{mathpazo}  
\usepackage[T1]{fontenc} 
\linespread{1.15} 

\makeatletter
\renewcommand\@biblabel[1]{\textbf{#1.}} 
\renewcommand{\@listI}{\itemsep=0pt} 

\renewcommand{\maketitle}{ 
\begin{flushright} 
{\LARGE\@title} 
\vspace{50pt} 

{\large\@author} 
\\\@date 

\vspace{40pt} 
\end{flushright}
}



\title{\textbf{Lysine Price-Fixing Conspiracy}\\ 
Causes and the aftermath} 

\author{\textsc{aaa}} 

\date{\today} 

\begin{document}

\maketitle 
\newpage
\tableofcontents
\newpage
\section*{Abstract}
Morbi tempor congue porta. Proin semper, leo vitae faucibus dictum, metus mauris lacinia lorem, ac congue leo felis eu tu

\newpage


\vspace{30pt} 


\section*{Introduction}

This statement requires citation \cite{heu}; this one does too 
%------------------------------------------------

\section*{Section Name}

C


\section*{Conclusion}

Fusce in nibh augue. Cum sociis natoque penatibus et magnis dis is ac blandit eget, dignissim quis nunc.

\begin{enumerate}
\item First numbered list item
\item Second numbered list item
\end{enumerate}

Donec luctus tincidunt mauris, non ultrices ligula aliquam id. Se


\newpage

\begin{thebibliography}{99}
    \addcontentsline{toc}{chapter}{Bibliografia}

    \bibitem{beaman} Juliusz Beaman, \textit{Morbidity of the Jolly
        function}, Mathematica Absurdica, 117 (1965) 338--9.




\end{thebibliography}



\end{document}
3

You have disabled the entries in the table of contents by using the star form of the \section command. Remove the star and specify that sections should not be numbered via counter secnumdepth.

Also level chapter is not available for class article.

Example:

\documentclass[a4paper, 12pt]{article}

\setcounter{secnumdepth}{0}

\begin{document}

\tableofcontents

\newpage
\section{Abstract}
Morbi tempor congue porta. Proin semper, leo vitae faucibus dictum, metus
mauris lacinia lorem, ac congue leo felis eu tu

\section{Introduction}
\section{Section Name}
\section{Conclusion}
\begin{thebibliography}{99}
    \addcontentsline{toc}{section}{Bibliografia}

    \bibitem{beaman} Juliusz Beaman, \textit{Morbidity of the Jolly
        function}, Mathematica Absurdica, 117 (1965) 338--9.
\end{thebibliography}

\end{document}

Result

Adding dots for section level in table of contents

The following example patches \l@section, which is responsible for formatting the section entries in the table of contents. The dot setting is taken from \@dottedtocline:

\documentclass[a4paper, 12pt]{article}

\usepackage{etoolbox}
\makeatletter
\patchcmd\l@section{%
  \nobreak\hfil\nobreak
}{%
  \nobreak
  \leaders\hbox{%
    $\m@th \mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$%
  }%
  \hfill
  \nobreak
}{}{\errmessage{\noexpand\l@section could not be patched}}
\makeatother

\setcounter{secnumdepth}{0}

\begin{document}

\tableofcontents

\newpage
\section{Abstract}
Morbi tempor congue porta. Proin semper, leo vitae faucibus dictum, metus
mauris lacinia lorem, ac congue leo felis eu tu

\section{Introduction}
\section{Section Name}
\subsection{Subsection Name}
\section{Conclusion}
\begin{thebibliography}{99}
    \addcontentsline{toc}{section}{Bibliografia}

    \bibitem{beaman} Juliusz Beaman, \textit{Morbidity of the Jolly
        function}, Mathematica Absurdica, 117 (1965) 338--9.
\end{thebibliography}

\end{document}

Result with dots

| improve this answer | |
  • thank you, but i would like to have dots in table of contents (Between title of the section and number of the page). How to do that? – vforbiedronka May 23 '15 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.