2

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

  • This is typical for word, but think about it. Do you really need the word Pict for every item in a list of figures. I guess your readers are intelligent enough. – Johannes_B Jun 4 '14 at 8:31
  • 1
    btw: using KOMA-script you can just use listof=entryprefix – Johannes_B Jun 4 '14 at 8:31
  • @johannes_B you're right. but the problem is that my boss wants it that way and doesn't want to change ... :/ – eniem Jun 4 '14 at 11:17
2

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}
  • Thank you ... but is there a possible solution with titletoc? (I use it for a lot of formatting, so it's a bit difficult to remove it 'cause then the layout doesn't work anymore :/ ) – eniem Jun 4 '14 at 11:27
  • @eniem Please see my extended answer and the disclaimers. – Johannes_B Jun 4 '14 at 13:59

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.