GeneralProblem with list of tables and figures

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
luzmara
Posts: 18
Joined: Thu Sep 04, 2008 3:45 pm

Problem with list of tables and figures

Post by luzmara »

Hi,

I need that in my list of tables and figures appear the word Table 1 - and Figure 1 -, I can do that the word Table and figure appear but I cant make that the symbol -- appear after the table or figure number, I'm using the following command, just need know how to insert the symbol --, like this Table 1 -- and Figure 1 --;

Code: Select all

\makeatletter
\renewcommand\l@figure[2]{\@dottedtocline{1}{3.0em}{1.5em}{\hspace*{-3.15em}Figura #1}{#2}}
\renewcommand\l@table[2]{\@dottedtocline{1}{3.0em}{1.5em}{\hspace*{-3.15em}Tabela #1}{#2}}
\makeatother
Thanks for your help,

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Problem with list of tables and figures

Post by localghost »

With help of the tocloft package you can modify the appearance of the LoF and the LoT. Take this as an example.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage{tocloft}

\renewcommand*\cftfigpresnum{Figure~}
\renewcommand*\cfttabpresnum{Table~}
\settowidth{\cftfignumwidth}{\cftfigpresnum}
\settowidth{\cfttabnumwidth}{\cfttabpresnum}
\renewcommand{\cftfigaftersnumb}{~~--~}
\renewcommand{\cfttabaftersnumb}{~~--~}

\begin{document}
  \listoffigures
  \listoftables
  \newpage

  \begin{figure}[!ht]
    \centering
    \rule{4cm}{3cm}
    \caption{Test}
  \end{figure}

  \begin{table}[!ht]
    \centering
    \rule{4cm}{3cm}
    \caption{Test}
  \end{table}
\end{document}
Note that if you are using the subfig package in your document (and only then), you have to give an option when loading tocloft.

Code: Select all

\usepackage[subfigure]{tocloft}

Best regards and welcome to the board
Thorsten¹
luzmara
Posts: 18
Joined: Thu Sep 04, 2008 3:45 pm

Re: Problem with list of tables and figures

Post by luzmara »

Hi,

Thanks for the help, its work so good; there is any way to do the same without the tocloft? I mean with the code that I tried, in that the list of tables or figures appear like this

Table 1 xxxxxxxxxxxx
Table 2 yyyyyyyyyyy

I just want to add the - symbol

Table 1 - xxxxxxxxx
Table 2 - yyyyyyyyyy

Thanks,
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Problem with list of tables and figures

Post by localghost »

luzmara wrote:[...] Thanks for the help, its work so good; there is any way to do the same without the tocloft? [...]
If I knew that I would have provided such a solution. For me this version with using a package is the easier way. But perhaps somebody else can offer an alternative.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Problem with list of tables and figures

Post by Stefan Kottwitz »

Hi luzmara,
luzmara wrote:there is any way to do the same without the tocloft?
yes, you could redefine \numberline and insert -- there:

Code: Select all

{\makeatletter
\renewcommand*\numberline[1]{\hb@xt@\@tempdima{#1 -- \hfil}}
\makeatother
\listoffigures
\listoftables}
Stefan
LaTeX.org admin
luzmara
Posts: 18
Joined: Thu Sep 04, 2008 3:45 pm

Problem with list of tables and figures

Post by luzmara »

Hi Stefan,

Thanks for your help, I tried to do the same with the following code, it work but I failed to add the -- symbol, what have to do?

Code: Select all

\makeatletter
\renewcommand\l@figure[2]{\@dottedtocline{1}{3.0em}{1.5em}{\hspace*{-3.15em}Figura #1}{#2}}
\renewcommand\l@table[2]{\@dottedtocline{1}{3.0em}{1.5em}{\hspace*{-3.15em}Tabela #1}{#2}}
\makeatother
Thanks
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Problem with list of tables and figures

Post by Stefan Kottwitz »

You can use it together, like:

Code: Select all

\documentclass[a4paper,10pt]{book}

\makeatletter
\renewcommand\l@figure[2]{\@dottedtocline{1}{3.0em}{1.5em}{\hspace*{-3.15em}Figura #1}{#2}}
\renewcommand\l@table[2]{\@dottedtocline{1}{3.0em}{1.5em}{\hspace*{-3.15em}Tabela #1}{#2}}
\makeatother

\begin{document}

{\makeatletter
\renewcommand*\numberline[1]{\hb@xt@\@tempdima{#1 -- \hfil}}
\makeatother
\listoffigures
\listoftables}
....
% figures and text following
Stefan
LaTeX.org admin
Post Reply