I am trying to add a heading in the list of figures and list of tables. I found a solution here:
Include chapters in List of Figures with titletoc?
However, this looks pretty complicated and I after some more googling I found this webpage:
http://www.personal.ceu.hu/tex/toc.htm
which show how to add a single line to toc, lof and lot using just 1 command. This seemed to be my solution however when I add the following line:
\addtocontents{lof}{Heading}
I get an error message: ! LaTeX Error: Something's wrong--perhaps a missing \item.
I googled and found this webpage which shows a solution for this problem:
https://groups.google.com/forum/?fromgroups=#!topic/comp.text.tex/2IE68-IJJ6U
I tried different approaches such as:
\addtocontents{lof}{\protect\contentsline{chapter}{Heading 1}{}}
\addtocontents{lof}{\protect\contentsline{figure}{Heading 2}{}}
\addcontentsline{lof}{chapter}{\protect\numberline{}{Heading 3}}
\addcontentsline{lof}{figure}{\protect\numberline{}{Heading 4}}
The one which looks closest to what I want is the first command ...{Heading 1} However, using this command latex adds an extra line or extra vertical space so that there is a new line after Heading 1 in the lof.
This would be fixed by using:
\addtocontents{lof}{\textbf{Heading}}
However, as already written this results in an error. I don't understand why this simple command results in an error even though I am quite sure I got the syntax right.
So just to clarify how I would like to have my lof
here is a short example:
\textbf{1 Chapter}
1.1 Figure 1
1.2 Figure 2
\textbf{2 Chapter}
2.1 Figure 3
2.2 Figure 4
Can anyone help?
Here is my working example:
\documentclass[10pt,DIV=12,a4paper,numbers=noenddot]{scrreprt}
\begin{document}
\tableofcontents
\listoffigures
%
\addtocontents{lof}{\protect\contentsline{figure}{Heading 1}{}}
\addcontentsline{lof}{chapter}{\protect\numberline{}{Heading 2}}
\addcontentsline{lof}{figure}{\protect\numberline{}{Heading 3}}
% Closest to what I would prefer
\addtocontents{lof}{\textbf{Heading 4}\protect\par}
\addtocontents{lof}{\protect\contentsline{chapter}{Heading 5}{}}
\chapter{Introduction}
\section{s1}
\begin{figure}
\caption{figure 1}
\end{figure}
\begin{figure}
\caption{figure 2}
\end{figure}
\section{s2}
\chapter{Content}
\section{c1}
\section{c2}
\end{document}
I basically want the lof to look like the toc. There is no newline after "1 Introduction" and "2 Content". I also just realized that the font for "Heading 4" and "Heading 5" looks different. So I think I would prefer the font of "Heading 5" which I think is the one used in the toc. So "Heading 5" would be perfect if there would not be a newline afterwards. Is it possible to somehow suppress this newline?
\documentclass{...}
and ending with\end{document}
.\addtocontents{lof}{\textbf{Heading}\protect\par}
. See latex-project.org/cgi-bin/ltxbugs2html?pr=latex/….