1

After getting some great help for my initial question, I had to add a list of equations. I would need the list of figures and list of tables to be formatted the same way, basically without the intend of each chapter line. Also I would need to get rid of the chapter gab between each element, as it somehow makes no sense without the chapter sensitive numbering of elements.

Here is the MWE:

\documentclass[12pt, numbers=noenddot,parskip, headsepline, footsepline,headings=small,
listof=totoc,
index=totoc
]{scrreprt}

\usepackage[a4paper, includeheadfoot, left=3.5cm, right=1.7cm, top=2.5cm, bottom=2.0cm]{geometry}
\renewcommand{\floatpagefraction}{.75}%

\newcommand*{\listappendicesname}{Verzeichnis der Anlagen}

%%% see: https://komascript.de/comment/5578#comment-5578 (Markus Kohm)
\DeclareNewTOC[%
owner=\jobname,
listname=\listappendicesname,% Titel des Verzeichnisses
]{atoc}% Dateierweiterung (a=appendix, toc=table of contents)

\makeatletter
\newcommand*{\useappendixtoc}{%
    \renewcommand*{\ext@toc}{atoc}%
    \scr@ifundefinedorrelax{hypersetup}{}{% damit es auch ohne hyperref funktioniert
        \hypersetup{bookmarkstype=atoc}%
    }%
}
\ifundefinedorrelax{ext@toc}{%
    \newcommand*{\ext@toc}{toc}
    \renewcommand{\addtocentrydefault}[3]{%
        \expandafter\tocbasic@addxcontentsline\expandafter{\ext@toc}{#1}{#2}{#3}%
    }
}{}

\AfterTOCHead[atoc]{%
    % add the appendix TOC to the main TOC:
    {\def\ext@toc{toc}\addchaptertocentry{}{\listappendicesname}}
    \KOMAoptions{toc=nonumberline}
}
\makeatother

\usepackage{xpatch}% loads also etoolbox
\xapptocmd{\appendix}
{
    \useappendixtoc
    \listofatocs
    \renewcommand\chapterformat{\appendixname\ \thechapter:\enskip}%
    \renewcommand\thechapter{\arabic{chapter}}%
    \xpatchcmd{\addchaptertocentry}
    {\addtocentrydefault{chapter}{#1}{#2}}
    {\addtocentrydefault{chapter}{}{\appendixname\ #1:\ #2}}
    {}{\PatchFailed}
    \renewcommand\chaptermark[1]{\markboth{\chaptermarkformat}{\chaptermarkformat}}
    \renewcommand\chaptermarkformat{\appendixname\ \thechapter\autodot}
}
{}{\PatchFailed}


\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{equation}{chapter}
\counterwithout{table}{chapter}

\usepackage{refcount}
\usepackage{multicol}

\usepackage[onehalfspacing]{setspace}
\usepackage[ngerman]{babel}
\usepackage{blindtext}% only for dummy text

\usepackage{scrlayer-scrpage}% sets pagestyle scrheadings; headings is only a synonym
\automark[chapter]{chapter}
\clearpairofpagestyles
\ihead{\headmark}
\ohead{\pagemark}

\RedeclareSectionCommand[beforeskip=-1sp minus -1sp]{chapter}% no skip before the chapter title

\renewcommand{\topfraction}{.75}
\usepackage{enumitem}
\SetLabelAlign{LeftAlignFullWidth}{\makebox[\dimexpr\linewidth+\labelwidth\relax][l]{#1}}

\usepackage{xcolor}
\usepackage{microtype}
\usepackage{dirtytalk}% in TeXLive but not in MiKTeX

\usepackage{graphicx}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[colorlinks=true, linktocpage=true,citecolor=blue]{hyperref}% load as last package

\newcommand\NoIndent[1]{%
    \par\vbox{\parbox[t]{\linewidth}{#1}}%
}
\newcounter{savepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Added To MWE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsmath}

\DeclareNewTOC[%
tocentryindent=0pt,% kein Einzug im Verzeichnis
tocentrynumwidth=2em,% Einzug für den Text im Verzeichnis
type=equation
]{loe}
\AtBeginDocument{\renewcaptionname{ngerman}{\contentsname}{Inhalt}
    \newcaptionname{ngerman}\equationname{Formel}% 
    \newcaptionname{ngerman}\listequationname{Verzeichnis der Formeln}
    \renewcaptionname{ngerman}{\listfigurename}{Verzeichnis der Abbildungen}    %Figures
    \renewcaptionname{ngerman}{\listtablename}{Verzeichnis der Tabellen}        %Tables
    \renewcaptionname{ngerman}{\figurename}{Abb.}               %Figure
    \renewcaptionname{ngerman}{\tablename}{Tab.}                %Table
    \renewcaptionname{ngerman}{\bibname}{Verzeichnis der Literatur}             %Bibliography
    \newcaptionname{ngerman}{\lstlistlistingname}{Quelltexte} %Table of listings 
    \newcaptionname{ngerman}{\lstlistingname}{Quelltext}  }%


\makeatletter
\newcommand*{\@currententry}{}
% Zwei amsmath-Anweisungen ändern:
\g@addto@macro\make@display@tag{\set@currententry}%
\def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}%
    \set@currententry}
\newcommand*{\set@currententry}{%
    \typeout{set current entry}%
    \ifx\@currententry\@empty\else
    \addcontentsline{loe}{equation}{\protect\numberline{\@currentlabel}%
        \@currententry}%
    \global\let\@currententry\@empty
    \fi
}
% Neue Benutzeranweisung
\newcommand*{\equationentry}[1]{%
    \gdef\@currententry{#1}%
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Added To MWE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
    \pagenumbering{Roman}
\tableofcontents
\listofequations
\listoffigures
\listoftables
    \setcounter{savepage}{\value{page}}

    \cleardoublepage
    \pagenumbering{arabic}

    %   \blinddocument
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %Added To MWE
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \chapter{Kapitel 1}
    \begin{equation}\label{eq:Eq1}\equationentry{P-Anteil}
    a=b
    \end{equation}
    \newpage

    \centering% center the table
    \captionaboveof{table}{My caption}
    \label{my-label}
    \begin{tabular}{lllll}
        & \multicolumn{2}{l}{XYZ} & \multicolumn{2}{l}{ABC} \\
        & Sex         & P         & Sex         & P         \\
        AGE1 & 0.5         & 1         & 0.6         & 1         \\
        &             &           &             &          
    \end{tabular}


    \begin{figure}
        Test Figure
        \caption{No Intend Here} \label{fig:LableTest}
    \end{figure}

    \begin{figure}
    Test Figure
    \caption{No Intend Here} \label{fig:LableTest2}
\end{figure}
%   \blinddocument
        \begin{equation}\label{eq:Eq2}\equationentry{P-Anteil}
    a=b
    \end{equation}

        \begin{equation}\label{eq:3}\equationentry{P-Anteil}
    a=b
    \end{equation}

    \chapter{Kapitel 2}

            \begin{equation}\label{eq:Eq4}\equationentry{P-Anteil}
    a=b
    \end{equation}

    \begin{equation}\label{eq:5}\equationentry{P-Anteil}
    a=b
    \end{equation}

        \centering% center the table
    \captionaboveof{table}{My caption}
    \label{my-label2}
    \begin{tabular}{lllll}
        & \multicolumn{2}{l}{XYZ} & \multicolumn{2}{l}{ABC} \\
        & Sex         & P         & Sex         & P         \\
        AGE1 & 0.5         & 1         & 0.6         & 1         \\
        &             &           &             &          
    \end{tabular}


    \begin{figure}
        Test Figure
        \caption{No Intend Here} \label{fig:LableTest3}
    \end{figure}
    \blinddocument
    \appendix



\end{document}
1
  • 1
    Could you shorten your example. A handy example is very nice. A large example full of not needed code is demotivating. Jul 18, 2017 at 13:16

1 Answer 1

3

KOMA-Script classes provide option listof=flat for flat lists of tables, figures etc. Flat in this context means without indention. They also provide option listof=nochaptergap to avoid the vertical distance before elements of another chapter.

\documentclass[12pt, numbers=noenddot,parskip, headsepline, footsepline,headings=small,
listof=totoc,listof=nochaptergap,listof=flat,
index=totoc
]{scrreprt}

\begin{document}
  \tableofcontents
  \listoffigures
  \listoftables
  \chapter{First chapter}
  \captionof{table}{First table}
  \captionof{table}{Second table}
  \captionof{figure}{First figure}
  \chapter{Second chapter}
  \captionof{table}{Third table}
  \captionof{figure}{Second figure}
  \captionof{figure}{Third figure}
\end{document}

results in:

enter image description here

As an side effect, option listof=flat also detects the width needed for the numbers automatically. But this means, if you add a figure or table with a wider (or smaller) number you may need an additional run to get a correct list of tables.

See the KOMA-Script manual (scrguien.pdf or scrguide.pdf) for more information about option listof and all the values you can assign to this option.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .