4

Hello I want to add a prefix to list of figures. Is there any way how to do it ? I am using \documentclass[12pt]{article} and \usepackage[czech]{babel}.

Result which I need.

I have found this solution which helped but not as I wanted to. It showed full name Obrázek instead of Obr. (Figure x Fig.)

{%
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\figurename~\oldnumberline}%
\listoffigures%
}
4
  • Welcome to TeX.SX! It would be great if you could show us what you have tried. Posting a minimal working example that indicates what you are trying to do makes it easier for people to understand what you want. It also makes it easier for people to help you, since they have some code to start from, and hence much more likely that some one will try to help you.
    – user30471
    Jan 26, 2020 at 21:50
  • I've tried this :
    – user205597
    Jan 26, 2020 at 21:56
  • Please use edit to add your code to the original post.
    – Teepeemm
    Jan 26, 2020 at 22:10
  • \figurename expands to Obr\'azek (using Babel one presumes), so just replace it with Obr. Jan 27, 2020 at 14:53

3 Answers 3

5

You can do this also using the tocloft package. If you're independently using titlesec for something, then Vincent's answer is probably to be preferred. Adjust the spacing for the label and number as needed.

\documentclass{article}
\usepackage[czech]{babel}
\usepackage{tocloft}
\renewcommand{\cftfigpresnum}{Obr.~}
\setlength{\cftfignumwidth}{5em}
\begin{document}
\listoffigures
\begin{figure}
A figure
\caption{A caption}
\end{figure}
\begin{figure}
A figure
\caption{A caption}
\end{figure}
\begin{figure}
A figure
\caption{A caption}
\end{figure}
\end{document}

output of code

3

It can be done with the \titlecontents command from the titletoc package (see the documentation for more details). For example, with

\documentclass{article}
\usepackage[czech]{babel}
\usepackage{titletoc}
\titlecontents{figure}[0mm]%
    {\makebox{Obr.~}}%
    {\makebox{\thecontentslabel\quad}}%
    {}%
    {\enspace\dotfill\enspace\thecontentspage}
\begin{document}
\listoffigures
\begin{figure}
\caption{A first figure}
\end{figure}
\begin{figure}
\caption{A second figure}
\end{figure}
\begin{figure}
\caption{Again another figure}
\end{figure}
\end{document}

we get the following list of figures.

0

The following lines can do the work but the next line of caption is not indented with this method if the caption is longer than one line. How to fix that?

{%


\documentclass{article}%

\usepackage[czech]{babel}%

\usepackage{titletoc}%

\titlecontents{figure}[0mm]%

    {\makebox{Obr.~}}%
    {\makebox{\thecontentslabel\quad}}%
    {}%
    {\enspace\dotfill\enspace\thecontentspage}


}
1
  • 2
    Please raise this question individually and delete this reply.
    – MS-SPO
    Jul 19, 2022 at 23:48

You must log in to answer this question.

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