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:


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:


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:


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:


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:



\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}{}}


\caption{figure 1}

\caption{figure 2}




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?

  • Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – jub0bs
    Mar 11, 2013 at 18:24
  • Well a complete example that demonstrates your error would be much more useful than all this code snippets. Regarding your error use \addtocontents{lof}{\textbf{Heading}\protect\par}. See latex-project.org/cgi-bin/ltxbugs2html?pr=latex/…. Mar 11, 2013 at 18:24
  • 1
    Are you inserting chapters and figures manually?
    – egreg
    Mar 11, 2013 at 18:32

1 Answer 1


The answer to the question linked provides and automated solution; if you, for some reason, decide to do this manually (which might be a cause for problems: for example, the automated solution won't add heading if there's no figures in a chapter and manually you can overlook this), you can proceed as in the xample below.

Using a variation of Martin Scharrer's answer to Table of Contents with additional description of entries, I defined a \headinginfo command which typesets its mandatory argument in the LoF, using the same formatting as chapter entries in the ToC (since a KOMA class is used, this is easily achieved using \usekomafont{disposition}); the \headinginfo command must be used before the first figure environment of a chapter (I would suggest immediately after the corresponding \chapter):


% A modification of the kernel's \@dottedtocline,
% suppressing the leaders (dots) and page number
% A variation of Martin Scharrer's answer:
% https://tex.stackexchange.com/a/10189
    \vskip \z@ \@plus.2\p@
    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
     \parindent #2\relax\@afterindenttrue
     \@tempdima #3\relax
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip


\chapter{Test Chapter One}
\headinginfo{Some Text for Chapter One}
\caption{A test figure}
\caption{Another test figure}

\chapter{Test Chapter Two}
\headinginfo{Some Text for Chapter Two}
\caption{A test figure}
\caption{Another test figure}


enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.