community,

I have received great help many times before on this platform and I really do hope that you can help me yet again! I'm trying to customize my ToC in such a way that things like the List of Figures and List of Tables: 1. appear in the ToC 2. are written in cursive 3. are as sections as close together as subsections/are as subsections not indented

The first two points I could manage, but the last one just doesn't work:

\documentclass[paper=a4,12pt,numbers=endperiod]{scrartcl}
\usepackage{fontspec}
\setmainfont[SmallCapsFont={* Caps}]{Latin Modern Roman}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\usepackage[autostyle=true]{csquotes}
\usepackage{yfonts}
\usepackage{xltxtra}
\usepackage{graphicx}
\usepackage{float}
\usepackage{caption}
\usepackage[english]{fancyref}
\usepackage{tocbasic}
\KOMAoptions{toc=sectionentrydotfill}

\begin{document}
\newpage
\thispagestyle{empty}
\tableofcontents
\newpage
\listof{table}{\textit{List of Tables}}
\section*{\textit{List of Abbreviations}}
\section{Test}
Text
\section{Test2}
Text2
\end{document}
\section*{\textit{Glossary}}
\section*{\textit{Declaration of Originality}}


I have found a package that allows you to customize your ToC but I cannot really use it and it just produces errors all the time. I think it would be easiest to define a new section category (like 'nsection') that has a different baseline skip than the normal section (because I would very much like to keep that)

Edit: I have added more 'random' sections that are not their own function in LaTex in order to demonstrate that I want to be able to use 'nsection' for anything I want

Update (MWE in question and desired result are changed: usage of nsection not restricted to lists like LOF and LOT)

\documentclass[paper=a4,12pt,numbers=endperiod]{scrartcl}% loads and uses tocbasic!
\setmainfont[SmallCapsFont={* Caps}]{Latin Modern Roman}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\usepackage[autostyle=true]{csquotes}
\usepackage{yfonts}
\usepackage{graphicx}
%\usepackage{float}
\usepackage{caption}
\usepackage[english]{fancyref}

\KOMAoptions{
toc=sectionentrydotfill,
listof=totoc
}

\newkomafont{standardsection}{\Large}
\newkomafont{nsection}{\usekomafont{standardsection}\slshape}

\DeclareTOCStyleEntry[%
level=\sectiontocdepth,%
beforeskip=0pt plus .2pt,%
indent=0pt,%
numwidth=1.5em,%
entryformat=\usekomafont{sectionentry}\textsl%
]{section}{nsection}

\newcommand*\usensection{% define switch to nsection
\setkomafont{section}{\usekomafont{nsection}}%
}
\newcommand*\usestandardsection{% define switch to standard section
\setkomafont{section}{\usekomafont{standardsection}}%
}

\AfterStartingTOC[toc]{\clearpage}

\begin{document}
\tableofcontents

\usensection% switch to nsection
\listoftables
\listoffigures

\usestandardsection% switch to standard section
\section{Test}
Text
\section{Test2}
Text2

\usensection% switch to nsection

\end{document}


Result:

Original answer (nsection only needed for lists like LOF and LOT)

Here is a suggestion using a new declared TOCStyleEntry nsection for the entries of LOF and LOT in TOC. Therefore \addsectiontocentry is redefined locally.

Note that KOMA-Script class srcartcl already loads package tocbasic. So do not load it again.

\documentclass[paper=a4,12pt,numbers=endperiod]{scrartcl}% loads and uses tocbasic!
\setmainfont[SmallCapsFont={* Caps}]{Latin Modern Roman}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\usepackage[autostyle=true]{csquotes}
\usepackage{yfonts}
\usepackage{graphicx}
%\usepackage{float}
\usepackage{caption}
\usepackage[english]{fancyref}

\KOMAoptions{
toc=sectionentrydotfill,
listof=totoc
}

\DeclareTOCStyleEntry[%
level=\sectiontocdepth,%
beforeskip=0pt plus .2pt,%
indent=0pt,%
numwidth=1.5em,%
entryformat=\usekomafont{sectionentry}\textsl%
]{section}{nsection}
}

\AfterStartingTOC[toc]{\clearpage}

\begin{document}
\tableofcontents
\listoftables
\listoffigures
\section{Test}
Text
\section{Test2}
Text2
\end{document}


Result:

If the changes should be restricted to lists with owner=float (LOT, LOF, etc), you can use:

\makeatletter
\doforeachtocfile[float]{% do for all lists with owner=float like LOF and LOT
}%
}
\makeatother


Code:

\documentclass[paper=a4,12pt,numbers=endperiod]{scrartcl}% loads and uses tocbasic!
\setmainfont[SmallCapsFont={* Caps}]{Latin Modern Roman}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\usepackage[autostyle=true]{csquotes}
\usepackage{yfonts}
\usepackage{graphicx}
%\usepackage{float}
\usepackage{caption}
\usepackage[english]{fancyref}

\KOMAoptions{
toc=sectionentrydotfill,
listof=totoc
}

\DeclareTOCStyleEntry[%
level=\sectiontocdepth,%
beforeskip=0pt plus .2pt,%
indent=0pt,%
numwidth=1.5em,%
entryformat=\usekomafont{sectionentry}\textsl%
]{section}{nsection}
\makeatletter
\doforeachtocfile[float]{% do for all lists with owner=float like LOF and LOT
}%
}
\makeatother

\AfterStartingTOC[toc]{\clearpage}

\begin{document}
\tableofcontents
\listoftables
\listoffigures
\section{Test}
Text
\section{Test2}
Text2
\end{document}


Note that you will get the same result with

\BeforeTOCHead[lof]{%

• I was trying to find a solution without using the KOMA macros in KOMA (terrible work), so nice to see what KOMA offers! \BeforeTOCHead patches just locally the listof commands, right? It is changing the toc title font ('Contents') as well. Purely educational and before I start digging myself, maybe you know how to check for a certain listof to not change the toc title font? Or how should one solve that with KOMA? – nox Jun 29 '18 at 9:55
• Yes, BeforeTOCHead[<extension>]{\addtokomafont{section}{\slshape}} changes the font settings for the section titles locally. The optional argument <extension> can be used to do this for single lists or for lists of a special owner. See my answer. And thanks for the hint: I had overlooked that the font of the TOC title should not change. – esdd Jun 29 '18 at 10:21