I have to write an essay about another text. Therefore, I have to attach an additional table of contents, which does not actually show my document's structure, but lists sections that are not included in my document.

To clarify: There should be a normal TOC that lists my sections plus another TOC placed anywhere in my own document - not necessarily in the appendix or so.

To make things a little bit more difficult, the "second" TOC should not contain page numbers.

\documentclass[]{scrartcl}

\begin{document}
\tableofcontents

\section{Introduction}
Lorem ipsum...

\section{Some text}
blah blah

\section{Structure}

\end{document}


It should look like this:

Table of Contents
1  Introduction..................................1
2  Some text.....................................2
3  Structure.....................................4

1 Introduction
Lorem ipsum...

2 Some text
blah blah

3 Structure
1  First Chapter
2  Second Chapter
2.1  A Subsection
2.2  Another Subsection
3  Last Chapter


If the additional "TOC" should use the same settings for the section and subsection entries:

\documentclass[toc=sectionentrywithdots]{scrartcl}[2018/12/30]% needs version 3.26a
\DeclareNewTOC{str}
\BeforeStartingTOC[str]{%
\DeclareTOCStyleEntries[
linefill=\hfill,% no dots
pagenumberformat=\gobble% no page number
]{tocline}{section,subsection}%
}
\newcommand\gobble[1]{}

\newcounter{strsection}
\newcounter{strsubsection}
\counterwithin{strsubsection}{strsection}

\stepcounter{str#1}%
}
\begin{document}
\tableofcontents

\section{Introduction}
Lorem ipsum...

\section{Some text}
blah blah

\section{Structure}
\listoftoc*{str}

\end{document}


Because of a comment below: Overleaf seems to use an older TeX-Distribution, so \counterwithin needs package chnngcntr. The KOMA-Script Version there is outdated, too: a new project uses version KOMA-Script version 3.23, current version on CTAN is 3.26b. So you can not use \DeclareTOCStyleEntries. You have to replace it by two \DeclareTOCStyleEntry commands.

\documentclass[toc=sectionentrywithdots]{scrartcl}[2017/04/13]% tested for version 3.23
\usepackage{chngcntr}% <- needed for older TeX Distributions

\DeclareNewTOC{str}
\BeforeStartingTOC[str]{%
\DeclareTOCStyleEntry[
linefill=\hfill,% no dots
pagenumberformat=\gobble% no page number
]{tocline}{section}%
\DeclareTOCStyleEntry[
linefill=\hfill,% no dots
pagenumberformat=\gobble% no page number
]{tocline}{subsection}%
}
\newcommand\gobble[1]{}

\newcounter{strsection}
\newcounter{strsubsection}
\counterwithin{strsubsection}{strsection}

\stepcounter{str#1}%
}
\begin{document}
\tableofcontents

\section{Introduction}
Lorem ipsum...

\section{Some text}
blah blah

\section{Structure}
\listoftoc*{str}

\end{document}


The result is the same as above.

• This is exactly what I searched for. But when pasting your code to Overleaf, it throws me four errors. After adding \usepackage{chngcntr}, there are two left: Undefined control sequence. l.36 \listoftoc*{str} and LaTeX Error: Something's wrong--perhaps a missing \item. l.1 ... {section}{\numberline {1}First Chapter}{1}. After commenting out the DeclareNewTOC block, all errors are gone, but the additional TOC has page numbers. – ckuenzle Jun 9 at 7:38
• Overleaf uses an older TeX Distribution and an outdated KOMA-Script version. You have to replace \DeclareTOCStyleEntries by two \DeclareTOCStyleEntry commands: one for strsection and one for strsubsection. See my updated answer. – esdd Jun 9 at 15:54

I'd just use lists.

\documentclass{article}

\usepackage{enumitem}

\begin{document}

{
\setlist[enumerate]{label*=.\arabic*}
\setlist[enumerate, 1]{label=\arabic*}
\begin{enumerate}
\item First Chapter
\item Second Chapter
\begin{enumerate}
\item A Section
\item Another Section
\begin{enumerate}
\item A Subsection
\item One More Subsection
\end{enumerate}
\end{enumerate}
\item Last Chapter
\end{enumerate}
}

\end{document}


You can easily configure the appearance of the lists using enumitem and keep the design local by enclosing everything in a group.