I'm learning LaTeX and writing an essay. I would like my essay to have the page "Sisällys" list every chapter as follows:
1 Johdanto 2
2 Päätäntö 2
Lähteet 2
Itsearviointi 2
Currently, it is missing those unnumbered chapters completely and unnumbered chapters should start on the same column as the number in the numbered chapters. How can I fix this issue?
\documentclass[12pt]{article}
\title{\textbf{Gummi 0.8.0}}
\author{Alexander van der Meij}
\date{}
\addtolength{\topmargin}{-3cm}
\addtolength{\textheight}{3cm}
\usepackage{setspace}
\usepackage{mathpazo}
\usepackage{xurl}
\usepackage[%
left=3cm,%
right=3cm,%
top=2.5cm,%3
bottom=2.5cm,%
headheight=33pt,%
]{geometry}%
\usepackage[finnish]{babel}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\pagemark}
\begin{document}
\setlength{\footheight}{17.99445pt}
\topskip0pt
\vspace{\fill}
\thispagestyle{empty}
\begin{center}
title
$,$
name
\end{center}
\vspace*{\fill}
\begin{center}
\vspace{10em}
\end{center}
{\raggedleft number
Autumn 2022
subject
university
13.10.2022
}
\newpage
\setcounter{page}{1}
\onehalfspacing
\tableofcontents
\newpage
\noindent \section{Johdanto} lorem ipsum
\section{Päätäntö}
lorem ipsum
\section*{Lähteet}
\begin{itemize}
\item[] lorem1
\item[] lorem2
\item[] lorem3
\item[] lorem4
\end{itemize}
\section*{Itsearviointi}
dsadsd
\end{document}
titletocpackage, which comes withtitlesec, has a\titlecontentscommand, which takes into account numbered as well as unnumbered sections. See thetitlesecdocumentation, §6 (A ten minute guide to titletoc). – Bernard Oct 13 '22 at 18:50titlesecpackage but I was unable to find a working solution. – latexlearner Oct 14 '22 at 06:52