# Indenting individual elements in ToC

Sorry if this seems blatant and obvious, but I'm only beginning my adventure with LaTeX and I've run into a problem to which I cannot find a solution even among the existing questions.

I need first four paragraphs of a document included in a ToC but they get indented and I'd like them aligned to the left, just like the first section of my thesis. I added them explicitly with the following commands:

\setcounter{tocdepth}{5}
\tableofcontents


I have read that one can use tocloft package and the \cftsetindents command to set indentation of specific elements of the document. Is there a way to explicitly set indentation in toc for certain elements, like those 4 paragraphs in the beginning? I cannot seem to find anything that would demonstrate such option. From my code I get something like this:

but I need something like this:

I'd be very grateful for some hints and solutions. The \documentclass I use is article.

• How about \addcontentsline{toc}{section}{Abstract}? It'll put the text in bold, but its the paragraph specifier that's causing indentation. – rbrignall Jun 23 '18 at 11:04
• @RobertBrignall Yup, this sloved the indentation problem but bold text remains and it introduces spacing in the toc equal to that of sections. Not an optimal solution but will do for now. Thanks! – Krzysztof Czarnecki Jun 23 '18 at 12:55

Unfortunaly there is no MWE in the question. So we do not know which class is used and if you load a package like tocbasic, tocloft etc. Nevertheless the following should work:

\documentclass{article}
\usepackage[T1]{fontenc}

\makeatletter
\newcommand\l@myparagraph{\@dottedtocline{5}{0em}{0em}}
\makeatother

\setcounter{tocdepth}{5}

\usepackage{blindtext}% only for dummy text
\begin{document}
\tableofcontents

\Blinddocument
\end{document}


Result:

• Thanks, this solved the problem altogether! Next time I run into trouble I'll include a full MWE ;) – Krzysztof Czarnecki Jun 30 '18 at 12:15

I think it's better to abuse \part instead of \paragraph.

\documentclass[a4paper,twoside]{article}
\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc} % not necessary for LaTeX 2018-04-01
\usepackage[english,polish]{babel}
\usepackage{tocloft}

\providecommand{\keywordsname}{}

\newcommand{\frontsection}[1]{%
\paragraph*{#1}%
}
% abuse part
\setlength{\cftbeforepartskip}{0pt}
\renewcommand{\cftpartfont}{\normalfont\normalsize}
\renewcommand{\cftpartpagefont}{\normalfont\normalsize}

\begin{document}

This should be the title page
\clearpage

\tableofcontents
\clearpage

\frontsection{\abstractname}
Streszczenie w języku polskim.

\begin{otherlanguage}{english}
\frontsection{\abstractname}
An abstract in English.
\end{otherlanguage}

\frontsection{\keywordsname}
Słowa kluczowe w języku polskim

\begin{otherlanguage}{english}
\frontsection{\keywordsname}
Keywords in English.
\end{otherlanguage}

\section*{Podziękowania}

• This also works but I don't quite understand why abusing \paragraph is a bad thing. – Krzysztof Czarnecki Jun 30 '18 at 12:17
• @KrzysztofCzarnecki Because you need to set secnumdepth to a high value – egreg Jun 30 '18 at 12:22