22

Is there a way to have a List of tables and figures as one list? Currently I have

\listoffigures 
\listoftables

which generates two lists and starts a new page for each list. What I want is a list that contains Tables and Figures in the same list, numbered in sequence (i.e. the first table should get the number following the last figure at that point), Babel-compatible and KOMA-Script-compatible if possible (I use both). The example command

\listoffiguresandtables

should create something like

List of Figures and Tables

1.1 A nice picture caption

1.2 Another nice picture caption

2.1 A caption of a cool table

How to do this?

  • \let\c@table=\c@figure will solve part of your problem: it will give a single numbering scheme for tables and figures. Tables and figures will still be different lists. – Charles Stewart Jun 23 '13 at 10:17
  • Your question isn't clear on whether you want them numbered in the same sequence. If you do, the easiest thing is just to use figure environment for all cases. If that doesn't do what you want could you say what you want to be different. – David Carlisle Jun 23 '13 at 10:28
  • @DavidCarlisle: Or \let\figure\table\let\endtable\endfigure ;-) – Marco Daniel Jun 23 '13 at 10:35
  • @DavidCarlisle If I just use figure everywhere then the tables won't have "Table 2.1: [caption]" below them, but "Figure 2.1: [caption]". – Foo Bar Jun 23 '13 at 10:45
  • @FooBar \renewcommand\figurename{Table}\caption{.....} – David Carlisle Jun 23 '13 at 10:52
17
\def\table{\def\figurename{Table}\figure}
\let\endtable\endfigure 

Should put all figures and tables in the same sequence and write Table for table captions.

The list of figures will still say list of figures, if you want to change that add

\renewcommand\listfigurename{List of Figures and Tables}
  • This gives me \caption outside float on all tables. And I assume it should mean \let\endtable\endfigure (instead of '\lettendtable\endfigure')? – Foo Bar Jun 23 '13 at 11:06
  • 1
    @FooBar it would work if you did what I meant, not what I wrote:-) will fix... – David Carlisle Jun 23 '13 at 11:09
  • I want to mention one small drawback: it doesn't work with captionof. – Marco Daniel Jun 23 '13 at 11:14
  • 1
    Note that the \renewcommand\listfigurename should be put just before the call to \listoffigures. I tried setting it in the preamble and it seemed to have no effect in my case (it might have been reset by \begin{document} or some package). – Georges Dupéron May 23 '16 at 10:04
  • 1
    @GeorgesDupéron probably some babel language resetting it? In that case the official way would be to modify the babel language-specific text in the preamble, but as you say defining it just where it is used works as well – David Carlisle May 23 '16 at 10:12
18

You can use the following definition in your header:

\makeatletter
\renewcommand*{\ext@figure}{lot}
\let\c@figure\c@table
\let\ftype@figure\ftype@table
\let\listoftableandfigures\listoftables
\renewcommand*\listtablename{List of Tables and figures}
\makeatother

The leads to:

enter image description here

\documentclass{scrreprt}

\makeatletter
\renewcommand*{\ext@figure}{lot}
\let\c@figure\c@table
\let\ftype@figure\ftype@table
\let\listoftableandfigures\listoftables
\renewcommand*\listtablename{List of Tables and figures}
\makeatother

\begin{document}
\listoftableandfigures


\chapter{foo}
Text

\begin{table}[!ht]
\caption{A table}
\end{table}

Text

\begin{figure}[!ht]
\caption{A figure}
\end{figure}

Text

\begin{table}[!ht]
\caption{A table}
\end{table}

Text

\begin{figure}[!ht]
\caption{A figure}
\end{figure}

\chapter{foo}
Text

\begin{table}[!ht]
\caption{A table}
\end{table}

Text

\begin{figure}[!ht]
\caption{A figure}
\end{figure}

Text

\begin{table}[!ht]
\caption{A table}
\end{table}

Text

\begin{figure}[!ht]
\caption{A figure}
\end{figure}

\end{document}
  • Thank you, too, this works as well, so +1. I accepted @DavidCarlisle's answer however because it needs less code. – Foo Bar Jun 23 '13 at 11:29
  • 2
    +1, because this solution also supports hyperref's \autoref feature. – Heiko Oberdiek Jun 23 '13 at 11:42

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.