1

My currente TOC is looking like this:

enter image description here

And here is a code sample:

\documentclass[]{article} 
\usepackage[latin1]{inputenc}
\usepackage{tocloft} %pacote para editar ToC
\usepackage{titlesec} %pacote para mudar formatacao de secoes

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

\titleformat*{\section}{\bfseries}
\titleformat*{\subsection}{}
\titleformat*{\subsubsection}{\bfseries}
\titleformat*{\paragraph}{\bfseries}
\titleformat*{\subparagraph}{}

\renewcommand{\contentsname}{\hfill\bfseries SUM\'{A}RIO\hfill} %centralizes toc title  
\renewcommand{\cftaftertoctitle}{\hfill} %centralizes toc title
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}} %places dots on sections lines as well

\begin{document}

\tableofcontents
\clearpage

\section{INTRODU\c{C}\~{A}O}

\subsection{SISTEMAS DE CHUTE}

\subsubsection{\bfseries chucrute}

\paragraph{\bfseries \textit{ablidebob}}

\subparagraph{\textit{abebob}}

\end{document}

However, my college requires everything in the TOC to be aligned to the left, like this:

enter image description here

But I just can't make that happen. Any suggestions?

  • As I suppose you use babel, note the brazilian option redefines \contentsname as Sumário, so you don't have to redefine it. – Bernard Apr 22 '16 at 22:07
1

The macro \cftsetindents{<X>}{<left margin>}{<title indent>} is what you need, where <X> is a sectioning unit name. In all cases, I have set the left indent to 0pt, and the title indent to 4em.

I also set \cftdotsep to make the dots closer, as per the OP's example. Finally I use \cftsetpnumwidth{1em} to reduce the space between dots and page number. It may need to be changed if your page count hits 3 digits.

\documentclass[]{article} 
\usepackage[latin1]{inputenc}
\usepackage{tocloft} %pacote para editar ToC
\usepackage{titlesec} %pacote para mudar formatacao de secoes

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

\titleformat*{\section}{\bfseries}
\titleformat*{\subsection}{}
\titleformat*{\subsubsection}{\bfseries}
\titleformat*{\paragraph}{\bfseries}
\titleformat*{\subparagraph}{}

\renewcommand{\contentsname}{\hfill\bfseries SUM\'{A}RIO\hfill} %centralizes toc title  
\renewcommand{\cftaftertoctitle}{\hfill} %centralizes toc title
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}} %places dots on sections lines as well

\cftsetindents{section}{0pt}{4em}
\cftsetindents{subsection}{0pt}{4em}
\cftsetindents{subsubsection}{0pt}{4em}
\cftsetindents{paragraph}{0pt}{4em}
\cftsetindents{subparagraph}{0pt}{4em}
\def\cftdotsep{1}
\cftsetpnumwidth{1em}

\begin{document}

\tableofcontents
\clearpage

\section{INTRODU\c{C}\~{A}O}

\subsection{SISTEMAS DE CHUTE}

\subsubsection{\bfseries chucrute}

\paragraph{\bfseries \textit{ablidebob}}

\subparagraph{\textit{abebob}}

\end{document}

enter image description here

  • Wow! Thank you very much! Thats just what I needed. I never thought it would be so simple. – C. B. José Apr 22 '16 at 21:35

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.