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

3
  • 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, 2014 at 8:31
  • 1
    btw: using KOMA-script you can just use listof=entryprefix
    – Johannes_B
    Jun 4, 2014 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, 2014 at 11:17

2 Answers 2

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}
2
  • 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, 2014 at 11:27
  • @eniem Please see my extended answer and the disclaimers.
    – Johannes_B
    Jun 4, 2014 at 13:59
0

I know this one is 7 years old, but to not make future reader confused on the not working solution via titletoc (yes, KOMA-script is easier), All you need is to add \hspace{-x} before \figurename. That means :

\usepackage{titletoc}
\titlecontents{figure}[3.0cm]%left section/margin
{}%abovecode, aka global formats usually
{\hspace{-2.2cm} \figurename  \ \thecontentslabel \}%numbered figure, in this case
{}%unnumbered figure, mostly unneeded for me
{\titlerule*[0.12cm]{.}\contentspage}%filler page, for the dotted lines
[\addvspace{6pt}] %vertspace, could be empty if you like it.

As you can see, the two important number to adjust is the number on left margin and the \hspace before figurename in numbered entry (and unnumbered, if you wish). For me 3 cm and -2.2cm is the answer, yours might differ.

My result would be

Figure 4.2 Lorem ipsum dolor sit amet consectetur elit
           Consectetur adipiscing elit ................ 42

and not

4.2 Figure Lorem ipsum dolor sit amet consectetur elit
           Consectetur adipiscing elit ................ 42

or

Figure 4.2 Lorem ipsum dolor sit amet Consectetur elit
Consectetur adipiscing elit ........................... 42

It's not perfect (positioning is a mess, if you have a one-liner lof and two-liner they're not going to start at the same place i.e. the word figure doesn't actually start at the same place )

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .