Although I consider it absolutely pointless to prefix the numbers in the list of figures or list of tables with “figure” or “table”, because nobody would expect anything other than a figure or table in the corresponding directory, the KOMA-Script classes nevertheless offer the option listof=entryprefix
. The text used is then \listof*file extension*entryname
before the number, i.e. \listoflofentryname
for the list of figures and \listoflotentryname
for the list of tables. These are predefined in the KOMA-Script classes with \figurename
or \tablename
and are therefore dependent on the current language.
Example:
\documentclass[listof=entryprefix]{scrartcl}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\section{Example}
This is an example section with a figure and a table.
\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{A square of 1\,cm width and height}
\end{figure}
\begin{table}
\centering
\begin{tabular}{lr}
left & right \\
1 & 2 \\
\end{tabular}
\caption{A left aligned left column and a right aligned right column}
\end{table}
\end{document}
More information on the listof=entryprefix
option can be found in the user manual.
Incidentally, it is also very easy to insert a colon after "Figure N" or "Table N". As the KOMA-Script classes use the \autodot
documented in the user guides, this only needs to be redefined locally for the two directories. To do this, simply add somewhere in the document preamble:
\BeforeStartingTOC[lof]{\renewcommand*{\autodot}{:}}
\BeforeStartingTOC[lot]{\renewcommand*{\autodot}{:}}
More information on \BeforeStartingTOC
can be found in the user guides.
As of KOMA-Script 3.46 instead:
\DeclareTOCStyleEntries[numberpostfix=:]{tocline}{figure,table}
is recommended. The advantage of this version is that the class options numbers=autoenddot
, numbers=enddot
or numbers=noenddot
are still taken into account.
Um sowohl den Präfix „Abbildung“ bzw. „Tabelle” als auch den Doppelpunkt auch bei Verwendung einer Standardklasse zu erreichen, kann man die letzte Lösung auch noch um eine passende Einstellung numberprefix
erweitern. Zusätzlich sollte man dann dynnumwidth
verwenden oder aber mit numwidth
eine passende neue Breite für die Nummer einschließlich Präfix angeben:
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{tocbasic}
\DeclareTOCStyleEntries[numberpostfix=:]{tocline}{figure,table}
\DeclareTOCStyleEntry[numberprefix=\figurename\ ,dynnumwidth]{tocline}{figure}
\DeclareTOCStyleEntry[numberprefix=\tablename\ ,dynnumwidth]{tocline}{table}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\section{Beispiel}
Dies ist ein Beispielabschnitt mit einer Abbildung und einer Tabelle.
\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{Ein Quadrat mit 1\,cm Kantenlänge}
\end{figure}
\begin{table}
\centering
\begin{tabular}{lr}
links & rechts \\
1 & 2 \\
\end{tabular}
\caption{Eine linksbündige linke Spalte und eine rechtsbündige rechte Spalte}
\end{table}
\end{document}
Of course, in this example the package tocbasic
, which provides the required options, must be loaded explicitly.