0

Currently my list of figures looks like this
List of Figures Figures 1 ........................x Figures 2.........................x
How to make like this?
List of Figures Figures 1 ........................x Figures 2.........................x
Thank you

My code is:

\documentclass[a4paper,12pt,openleft]{book}
\begin{document}

\tableofcontents
\listoffigures

\chapter{chapter 1}
\begin{figure}[h]
\centering
\includegraphics{images.png}
\caption[Figure~\ref{fig:fig1}]{caption}
\label{fig1}
\end{figure}

\chapter{chapter 2}
\begin{figure}[h]
\centering
\includegraphics{images2.png}
\caption[Figure~\ref{fig:fig2}]{caption2}
\label{fig2}
\end{figure}
\end{document}
5
  • 1
    Welcome to TeX SX! Could you post a minimal working example?
    – Bernard
    Jan 13 '18 at 15:23
  • 1
    Welcome to TeX.SE. You're description is not really useful because we don't see which code produces this output. Please post a compilable, minimal document that has this issue
    – user31729
    Jan 13 '18 at 15:23
  • 1
    Welcome to TEX.SX. Please, add a minimal working example, i.e. a compilable code which would help us to solve your problem.
    – bmv
    Jan 13 '18 at 15:23
  • Thanks for the suggestions @bmv, but it's not working
    – zeirash
    Jan 13 '18 at 16:02
  • 1
    @zeirash Actually, your code is not compilable. You should add \usepackage{graphicx} in order to use \includegraphics. I don't know what is not working for you, see my detailed answer below.
    – bmv
    Jan 13 '18 at 16:17
0

If you desire to have no indentation before the entries of the list of figures, you should use tocloft package, and set \cftfigindent to 0pt. See code below.

\documentclass[a4paper,12pt,openleft]{book}
\usepackage{graphicx}
\usepackage{tocloft}
\setlength{\cftfigindent}{0pt}
\begin{document}

\tableofcontents
\listoffigures

\chapter{chapter 1}
\begin{figure}[h]
\centering
\includegraphics{example-image-a}
\caption[Figure~\ref{fig1}]{caption}
\label{fig1}
\end{figure}

\chapter{chapter 2}
\begin{figure}[h]
\centering
\includegraphics{example-image-b}
\caption[Figure~\ref{fig2}]{caption2}
\label{fig2}
\end{figure}
\end{document}

enter image description here

2
  • Ah yes thank you, your code work. I just realized why my code won't work. It's because I use this package \usepackage[listformat=empty]{caption}. I use that because I want to remove the 1.1 and 2.1 before the name of figures. Is there any suggestions how to remove that?
    – zeirash
    Jan 13 '18 at 17:09
  • See question tex.stackexchange.com/questions/199207/…
    – bmv
    Jan 13 '18 at 22:50
0

The LOF is formatted by \l@figure which in turn calls \@dottedtocline to add the indentation etc. The figure/caption number is added by \numberline.

\documentclass[a4paper,12pt,openleft]{book}
\usepackage{showframe}% debugging tool

\makeatletter
\renewcommand*{\l@figure}[2]% #1 = \numberline[number}{text}, #2 = page
{\bgroup
  \let\numberline=\@gobble
  \@dottedtocline{1}{0pt}{0pt}{#1}{#2}%
\egroup}
\makeatother

\begin{document}

\tableofcontents
\listoffigures

\chapter{chapter 1}
\begin{figure}[h]
\centering
%\includegraphics{images.png}
\caption[Figure~\thefigure]{caption}
\label{fig1}
\end{figure}

\chapter{chapter 2}
\begin{figure}[h]
\centering
%\includegraphics{images2.png}
\caption[Figure~\thefigure]{caption2}
\label{fig2}
\end{figure}
\end{document}

Not the answer you're looking for? Browse other questions tagged or ask your own question.