[Tex/LaTex] add \figurename to \listoffigures (package titletoc)

koma-scripttable of contentstitletoc

at the moment I'm a little bit fighting with my listoffigures. – I 'just' want to put the \figurename(here it is "Pict.") in front of the \contentslabel in the lof. Here's a little code example:

\documentclass[oneside,openright,BCOR=5mm,paper=a4,fontsize=11pt]{scrbook}

\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[automark]{scrpage2}
\usepackage{xcolor}

\usepackage{geometry}
\geometry{a4paper, top=35mm, left=30mm, right=30mm, bottom=25mm, headsep=15mm, footskip=12mm}

\usepackage[demo]{graphicx}
\usepackage{textpos}
\usepackage{blindtext}
\usepackage{lipsum}
\usepackage{titletoc}

\usepackage{mparhack}

\addto\captionsngerman{\renewcommand{\figurename}{Pict.}}
\titlecontents{figure}[2.0cm]{\footnotesize}{\contentslabel{2.0cm}}{\hspace*{-1.5cm}}{\titlerule*[0.12cm]{.}\contentspage}[\addvspace{6pt}]

\begin{document}
\pagestyle{scrheadings}
\clearscrheadfoot
\ohead[\headmark]{\headmark}

\listoffigures

\chapter{Chapter}
\lipsum[1]

\begin{figure}[htbp]
  \centering
  \includegraphics[width=8cm,height=5cm]{demo}%
  \caption{My Picture}
\end{figure}

\end{document}

At the moment I tried this one:

\titlecontents{figure}[2.0cm]{\footnotesize}{\figurename\contentslabel{2.0cm}}{\hspace*{-1.5cm}}{\titlerule*[0.12cm]{.}\contentspage}[\addvspace{6pt}]

… but this always leads to something like:

"1.1 Pict.            My Picture ................................ 2"

But – as you might guess – that's not the thing I want. I want a result like:

"Pict. 1.1            My Picture with a long caption that has to
                      be broken ................................. 2"

Does anyone have a solution for me?
Thanks in advance,

eniem

Best Answer

Adding the same word to every single item in a list seems not the best way to be. Usually the types are given by the listname, for example List of Tables (Tabellenverzeichnis) or List of Figures (Abbildungsverzeichnis).

But if you really want to do that, you can use listof=entryprefix. I completely removed titletoc in my example, because it's use is not recommended with KOMA-classes.

\documentclass[listof=entryprefix]{scrbook}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[automark]{scrpage2}

\usepackage{lipsum}
%\addto\captionsngerman{\renewcommand{\figurename}{Pict.}}
\renewcaptionname{ngerman}{\figurename}{Pict.}%also possible
%\usepackage{titletoc}
%\titlecontents{figure}[2.0cm]{\footnotesize}{\contentslabel{2.0cm}}{\hspace*{-1.5cm}}{\titlerule*[0.12cm]{.}\contentspage}[\addvspace{6pt}]
\begin{document}
\listoffigures

\chapter{Chapter}
\lipsum[1]

\begin{figure}[htbp]
  \centering
  \rule{4cm}{3cm}
  \caption{My Picture}
\end{figure}

\end{document}

Loading yet another toc-altering package, you can achieve it in a much complexer way. Since i am a regular KOMA-user, i don't have much experience with tocloft nor titletoc. There might be better ways and i highly recommend using the tools \KOMAScript already gives you.

I cannot recommend the following:

\documentclass{scrartcl}%JB just to keep it on one page
\usepackage[ngerman]{babel}
\usepackage{lipsum}
\renewcaptionname{ngerman}{\figurename}{Pict.}
%the dance of the drunken sailor starts
\usepackage{titletoc}
\titlecontents{figure}[\figurename 2.0cm]{\footnotesize}{\contentslabel{2.0cm}}{\hspace*{-1.5cm}}{\titlerule*[0.12cm]{.}\contentspage}[\addvspace{6pt}]
\usepackage{tocloft}
\newlength\mylena
\settowidth\mylena{Figure}
\addtolength\cftfignumwidth{\mylena}
\renewcommand\cftfigpresnum{\figurename\space}
%The dance is over, but his ankles hurt. There might be something broken
\begin{document}
\listoffigures

\begin{figure}[htbp]
  \centering
  \rule{4cm}{3cm}
  \caption{My Picture}
  \caption{My Picture}
  \caption{My Picture}
  \caption{My Picture}
\end{figure}

\end{document}
Related Question