3

I am writing my thesis with scrbook-class in XeLaTex. My figures and tables have to be numbered throughout the document (not within chapters) and I want them to be spelled out ("Abbildung" and "Tabelle" is done by ngerman automatically). I also have to add the abbreviated figure- and tablename ("Abb." and "Tab.") in the list of figures and tables, which I did with listof=entryprefix and changing the entryname with e.g. \renewcommand*\listoflofentryname{Abb.}.

Since I have a lot of figures and tables, I would like the chapters to show up in the lists of floats to give it more structure and ease the search, which can be done by chapteratlists=entry. So, what I want the list of figures/tables to look like is this:

List of Figures

1 Introduction

Abb. 1 Caption of first Figure...........7

Abb. 2 Caption of second figure.......9

2 Second Chapter

Abb. 3 Caption of third Figure........15

However, the problem is that I get this:

List of Figures

Abb. 1 Introduction

Abb. 1 Caption of first Figure..........7

Somehow, the entryprefix ("Abb."/"Tab") and the chapterprefix ("Kapitel"/"chapter" which I don't want to show up) get mixed up and the entryprefix is transferred onto the chapterprefix, whether I change the entryname of figures/tables or not and whether I use chapterprefix=false/true. This is my MWE:

\documentclass[ngerman,
        listof=totoc,
        chapteratlists=entry,
        chapterprefix=false,% problem remains even if I choose "true"
        listof=entryprefix]{scrbook}
\usepackage[ngerman]{babel}     
\usepackage{fontspec}
\usepackage{chngcntr}
    \counterwithout{figure}{chapter}
    \counterwithout{table}{chapter}
\usepackage{mwe}
\usepackage[hidelinks]{hyperref}% 

% caption names
\addtokomafont{captionlabel}{\bfseries}
\renewcommand*\listoflofentryname{\bfseries Abb.}% problem remains even if I remove this line
\renewcommand*\listoflotentryname{\bfseries Tab.}% problem remains even if I remove this line

\begin{document}
\tableofcontents
\listoffigures
\listoftables

\blinddocument

\begin{figure}[!h]
    \centering
    \rule{5cm}{2cm}
    \caption{First figure.}
\end{figure}

\begin{table}[h]
    \caption{First table.}
    \noindent
    \centering
    \begin{tabular}{|c|c|}
        \hline
        a & b\tabularnewline
        \hline\hline
        1 & 2\tabularnewline
        \hline
    \end{tabular}
\end{table}

\begin{figure}[!h]
    \centering
    \rule{5cm}{2cm}
    \caption{Second figure.}
\end{figure}

\begin{table}[h]
    \caption{Second table.}
    \noindent
    \centering
    \begin{tabular}{|c|c|}
        \hline
        a & b\tabularnewline
        \hline\hline
        1 & 2\tabularnewline
        \hline
        \end{tabular}
\end{table}

\end{document}

Of course I read the KOMA documentation. Although it is so detailed or maybe because I am no expert, I could not find an advice for my problem and would be very glad for any help to get my desired output. Thank you!

1 Answer 1

3

As a work around you can remove option listof=entryprefix and change the declaration of entry styles of figure and table:

\documentclass[ngerman,
        listof=totoc,
        chapteratlists=entry,
        chapterprefix=false,
        %listof=entryprefix
]{scrbook}
\usepackage[ngerman]{babel}
\usepackage{fontspec}
\usepackage{chngcntr}
    \counterwithout{figure}{chapter}
    \counterwithout{table}{chapter}
\usepackage{mwe}
\usepackage[hidelinks]{hyperref}% 

% caption names
\addtokomafont{captionlabel}{\bfseries}
\renewcommand*\listoflofentryname{Abb.}
\renewcommand*\listoflotentryname{Tab.}

\newcommand\entrynumberwithprefix[2]{%
  \bfseries\csname listof#1entryname\endcsname\ #2
}
\DeclareTOCStyleEntry[
  indent=0pt,
  dynnumwidth,
  entrynumberformat=\entrynumberwithprefix{lof}
]{default}{figure}
\DeclareTOCStyleEntry[
  indent=0pt,
  dynnumwidth,
  entrynumberformat=\entrynumberwithprefix{lot}
]{default}{table}

\begin{document}
\tableofcontents
\listoffigures
\listoftables

\blinddocument

\begin{figure}[!h]
    \centering
    \rule{5cm}{2cm}
    \caption{First figure.}
\end{figure}

\begin{table}[h]
    \caption{First table.}
    \noindent
    \centering
    \begin{tabular}{|c|c|}
        \hline
        a & b\tabularnewline
        \hline\hline
        1 & 2\tabularnewline
        \hline
    \end{tabular}
\end{table}

\begin{figure}[!h]
    \centering
    \rule{5cm}{2cm}
    \caption{Second figure.}
\end{figure}

\begin{table}[h]
    \caption{Second table.}
    \noindent
    \centering
    \begin{tabular}{|c|c|}
        \hline
        a & b\tabularnewline
        \hline\hline
        1 & 2\tabularnewline
        \hline
        \end{tabular}
\end{table}
\end{document}

Run three times to get

enter image description here


You could also patch \addchaptertocentry:

\documentclass[ngerman,
        listof=totoc,
        chapteratlists=entry,
        chapterprefix=false,
        listof=entryprefix
]{scrbook}
\usepackage[ngerman]{babel}
\usepackage{fontspec}
\usepackage{chngcntr}
    \counterwithout{figure}{chapter}
    \counterwithout{table}{chapter}
\usepackage{mwe}
\usepackage[hidelinks]{hyperref}% 

% caption names
\addtokomafont{captionlabel}{\bfseries}
\renewcommand*\listoflofentryname{Abb.}
\renewcommand*\listoflotentryname{Tab.}
\DeclareTOCStyleEntry[entrynumberformat=\textbf]{default}{figure}
\DeclareTOCStyleEntry[entrynumberformat=\textbf]{default}{table}

\usepackage{xpatch}
\makeatletter
\xpatchcmd\addchaptertocentry
  {\addxcontentsline{\@currext}{chapteratlist}[{#1}]{#2}}
  {\addxcontentsline{\@currext}{chapteratlist}{\makebox[1.5em][l]{#1}#2}}
  {}{\PatchFailed}
\makeatother

\begin{document}
\tableofcontents
\listoffigures
\listoftables

\blinddocument

\begin{figure}[!h]
    \centering
    \rule{5cm}{2cm}
    \caption{First figure.}
\end{figure}

\begin{table}[h]
    \caption{First table.}
    \noindent
    \centering
    \begin{tabular}{|c|c|}
        \hline
        a & b\tabularnewline
        \hline\hline
        1 & 2\tabularnewline
        \hline
    \end{tabular}
\end{table}

\begin{figure}[!h]
    \centering
    \rule{5cm}{2cm}
    \caption{Second figure.}
\end{figure}

\begin{table}[h]
    \caption{Second table.}
    \noindent
    \centering
    \begin{tabular}{|c|c|}
        \hline
        a & b\tabularnewline
        \hline\hline
        1 & 2\tabularnewline
        \hline
        \end{tabular}
\end{table}
\end{document}

Run three times to get

enter image description here

1
  • Thank you very much! Both options work nicely and give exactly the result I wanted.
    – Lysanne
    Oct 21, 2017 at 1:01

You must log in to answer this question.

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