GeneralHow to change prefix of numbers in ListOfTable or ListOfFigu

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
perl0101
Posts: 8
Joined: Sat Aug 29, 2009 3:59 am

How to change prefix of numbers in ListOfTable or ListOfFigu

Post by perl0101 »

Hello everyone,

I have one question. I want to change the prefix of numbers in List Of Table or List Of Figure. For example, from 1.1 to Figure 1.1 or Table 1.1. I tried the commande \usepackage{tocloft}. But there are a lot of errors and does not work. How can I do it?

thanks for your advice.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How to change prefix of numbers in ListOfTable or ListOfFigu

Post by gmedina »

Hi,

take a look at the following example:

Code: Select all

\documentclass{book}
\usepackage{tocloft}

\newlength\mylena
\settowidth\mylena{Figure}
\newlength\mylenb
\settowidth\mylenb{Table}

\addtolength\cftfignumwidth{\mylena}
\addtolength\cfttabnumwidth{\mylenb}

\renewcommand\cftfigpresnum{Figure }
\renewcommand\cfttabpresnum{Table }

\begin{document}
\listoffigures
\clearpage
\listoftables
\clearpage

\begin{figure}[!ht]
  \centering
  \rule{4cm}{3cm}
  \caption{test figure}
  \label{fig:test}
\end{figure}

\begin{table}[!ht]
  \centering
  \rule{4cm}{3cm}
  \caption{test table}
  \label{tab:test}
\end{table}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
perl0101
Posts: 8
Joined: Sat Aug 29, 2009 3:59 am

Re: How to change prefix of numbers in ListOfTable or ListOfFigu

Post by perl0101 »

More information:

The error messages are the following:

("C:\Program Files\MiKTeX 2.7\tex\latex\graphics\dvips.def"))) (subfigure.sty

! LaTeX Error: Command \c@lofdepth already defined.
Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.99 \newcounter{lofdepth}

? t
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How to change prefix of numbers in ListOfTable or ListOfFigu

Post by gmedina »

Since you are using the subfigure package, you must load the tocloft package using

Code: Select all

\usepackage[subfigure]{tocloft}
Please take into account however that subfigure is an obsolete package and shouldn't be used anymore. In its stead you can use either the subfig package or the subcaption package.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
perl0101
Posts: 8
Joined: Sat Aug 29, 2009 3:59 am

Re: How to change prefix of numbers in ListOfTable or ListOfFigu

Post by perl0101 »

I add 3 lines listed as follows. The prefix problem is solved. But new problem comes out. The title in Table of Content, List of Figures, and List of Tables are overlapped. How to solve this problem?

\usepackage[subfigure]{tocloft}
\renewcommand\cftfigpresnum{Figure }
\renewcommand\cfttabpresnum{Table }

Thanks.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How to change prefix of numbers in ListOfTable or ListOfFigu

Post by gmedina »

You have to increase the \cftfignumwidth and \cfttabnumwidth lengths: please take a look at the example code of my first reply in this thread. The tocloft documentation explains the details.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
perl0101
Posts: 8
Joined: Sat Aug 29, 2009 3:59 am

Re: How to change prefix of numbers in ListOfTable or ListOfFigu

Post by perl0101 »

Thank you, Gmedia.

I follow your suggestion by replacing subfigure package with subfig package and using the sample code you provided. The problems in ListOfTable and ListOfFigures are solved.

But in Table Of Contents, the first level title, such as, Chapter1 Introduction, is still overlap. Could you give me some suggestion on it?

Thanks in advance.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How to change prefix of numbers in ListOfTable or ListOfFigu

Post by gmedina »

Hi,

regarding this last issue, some advise has already been given in this other thread.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply