9

I use Lyx 2.1, document class : Report. My problem is that the titles of figures are written on the numbers at List of Figures. enter image description here

  • As in all cases, please post a MWE, not a half-code ;-) Your example is neither complete that it would run at all nor would it provide the described error. There are a lot of packages not needed to show the error (if reproducible at all) – user31729 Jun 29 '14 at 15:25
  • Ok, but the code is quite long – GoldRay Jun 29 '14 at 15:40
  • Shorten it please. As much as you can. Kick out everything as long as the error persists. – LaRiFaRi Jun 29 '14 at 17:38
12

Loading the tocloft package and using the macro \cftsetindents for figure and table items should do the job. Specifically, you could add the following code to your document's preamble:

\usepackage[titles]{tocloft}
\cftsetindents{figure}{0em}{3.5em}
\cftsetindents{table}{0em}{3.5em}

The second \cftsetindents instruction, i.e., the resetting of the indentation amount for the entries in the List of Tables, isn't strictly necessary for your document. However, doing so may be appropriate to keep the appearance of the List of Tables in sync with that of the List of Figures.

You're of course free to adjust the indentation amount (3.5em) to suit your preferences.

|improve this answer|||||
4

You can load package tocbasic and use the automatic number width feature for figure or table entries:

\usepackage{tocbasic}
\DeclareTOCStyleEntry[dynnumwidth]{tocline}{figure}% for figure entries
\DeclareTOCStyleEntry[dynnumwidth]{tocline}{table}% for table entries

A complete example to show this, would be:

\documentclass{report}

\usepackage{tocbasic}
\DeclareTOCStyleEntry[dynnumwidth]{tocline}{figure}

\usepackage{caption}% only to have \captionof for the example

\begin{document}
\listoffigures

\chapter{Generation of dummy entries to the list of figures}
\makeatletter
\@whilenum\value{figure}<200\do{%
  \captionof{figure}{This is test figure \thefigure}
}
\makeatother
\end{document}

You need at least three LaTeX runs to get the correct number width:

example with long numbers

You can find more information about package tocbasic, \DeclareTOCStyleEntry, style tocline and option dynnumwidth in the KOMA-Script manual, scrguien.pdf (English) or scrguide.pdf (German).

But if you want you can also change the number width manual using option numwidth, e.g.

\usepackage{tocbasic}
\DeclareTOCStyleEntry[numwidth=3.5em]{tocline}{figure}% for figure entries
\DeclareTOCStyleEntry[numwidth=3.5em]{tocline}{table}% for table entries

Both solutions can be used with every standard class and does also work with several other classes.

If you are already using a KOMA-Script class, you can use the same solution without loading package tocbasic, because these classes already load the package. But with KOMA-Script classes you can also add class option listof=flat:

\documentclass[listof=flat]{scrbook}

\begin{document}
\listoffigures

\chapter{Generation of dummy entries to the list of figures}
\makeatletter
\@whilenum\value{figure}<200\do{%
  \captionof{figure}{This is test figure \thefigure}
}
\makeatother
\end{document}
|improve this answer|||||
  • +1 Thanks for adding this answer here, too. It's a very useful alternative solution. – Alan Munn Jul 25 '17 at 16:10
  • @AlanMunn I was only able to do so, because you've found the duplicate. – Schweinebacke Jul 25 '17 at 16:19
1
% arara: pdflatex
% arara: pdflatex

\documentclass[12pt,french]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage[demo]{graphicx}
\usepackage{tikz}
\numberwithin{figure}{section}
\numberwithin{table}{section}
\linespread{1.5} %interligne
\usepackage{babel}
\usepackage[style=french, french=guillemets]{csquotes}
\MakeAutoQuote{<}{>}
\usepackage{hyperref}

\makeatletter
%\newcommand*\l@figure{\@dottedtocline{1}{1.5em}{2.3em}} % the original definition for the class "book"
\renewcommand*\l@figure{\@dottedtocline{1}{1.5em}{3em}} % adapt the second value to your needs
\let\l@table\l@figure
\makeatother

\begin{document}
\listoffigures
\setcounter{chapter}{3}
\setcounter{section}{3}
\setcounter{figure}{6}
\setcounter{page}{23}
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{D:/programmes/Lyx/workspace/conception/gérer_messages_1}
\caption{\label{Diagramme de classes gerer msg}Diagramme de classes du CU <Gérer Messages>}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{conception/gérer_msg}
\caption{\label{Diagramme cu gerer msg}Diagramme du cas d'utilisation détaillé <Gérer Messages>}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{D:/programmes/Lyx/workspace/conception/gérer_messages_1}
\caption{\label{Diagramme de classes gerer msg}Diagramme de classes du CU <Gérer Messages>}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{D:/programmes/Lyx/workspace/conception/séquences/supprimer_msg}
\caption{\label{Diagramme de seq supp msg}Diagramme de séquences <Supprimer Message>}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{conception/consulter_candidats}
\caption{\label{cu consulter candidat}Diagramme du cas d'utilisation détaillé <Consulter Candidats>}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{conception/consulter_candidatures}
\caption{\label{cu consulter candidature}Diagramme du cas d'utilisation <Consulter Candidatures>}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{conception/consulter_cand}
\caption{\label{diag de classes consulter candidature}Diagramme de classes du CU <Consulter Candidatures>}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{conception/générer_certif}
\caption{\label{cu générer certif}Diagramme du cas d'utilisation <Générer Certificats>}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{conception/générer_certificats_1}
\caption{\label{classes générer certif}Diagramme de classes du CU <Générer Certificats>}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{conception/gérer_comm_2}
\caption{\label{cu gérer comm}Diagramme du cas d'utilisation détaillé <Gérer Commissions>}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{conception/gérer_commissions}
\caption{\label{classes gérer comm}Diagramme de classes du CU <Gérer Commissions>}
\end{figure}\og
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{conception/délibrer_resultats}
\caption{\label{cu délibérer res}Diagramme du cas d'utilisation détaillé <Délibérer Résultats>}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{conception/délibrer_resultats_New1}
\caption{\label{classes délibérer res}Diagramme de classes du CU <Délibérer Résultats>}
\end{figure}
\end{document}

enter image description here

|improve this answer|||||

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.