1

Yesteday I was Searching in this site some help to construct my dissertation, my trouble was modify the style of the list of figures in LaTeX, more specificaly, add the word "Figure 1" before each entry in list of figures, then this answer helpS, look: enter link description here

But, moreover I need iserting a little dash between the word figure and the entry of the list. I need something like this:

Figure 1 - Entry of the list

For now, I don't have that little dash, someone can help with this, I'd be thankful!

I have this:

\documentclass{report}
\usepackage{chngcntr}  
\usepackage{tocloft}
\usepackage{hyperref}

\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}

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

\newlength{\mylenf}
\settowidth{\mylenf}{\cftfigpresnum}
\setlength{\cftfignumwidth}{\dimexpr\mylenf+1.5em}
\setlength{\cfttabnumwidth}{\dimexpr\mylenf+1.5em}


\makeatletter
\newcommand\listoftablesandfigures{%
    \chapter*{List of Tables and Figures}%
    \phantomsection
\@starttoc{lof}%
\bigskip
\@starttoc{lot}}
\makeatother

\begin{document}
\listoftablesandfigures

\chapter{Test one}
\section{Test one one}

\begin{table}
  \caption{Test table one}
\end{table}

\begin{figure}
  \caption{Test figure one}
\end{figure}

\chapter{Test two}
\section{Test two two}

\begin{table}
  \caption{Test table two}
\end{table}

\begin{figure}
  \caption{Test figure two}
\end{figure}

\end{document}

The result is this

enter image description here

How can I add a little dash between the words "Figure 1" and "Test of figure one"?

  • A lot of this depends on the document class you are using. Could you please provide a minimal example showing what you have now? – daleif Jul 1 '14 at 14:37
  • @daleif, Sure! Wait a moment please. – DiegoMath Jul 1 '14 at 14:38
  • @daleif I'm sorry, but I'm new here, I don't know how insert the latex code. – DiegoMath Jul 1 '14 at 14:44
  • It was edited! Some answer? Thanks! – DiegoMath Jul 1 '14 at 14:53
  • One question: How about the number of figs. If the number is more than 10, Figure 10 takes up more space than Figure 1, where should the alignment be? – daleif Jul 1 '14 at 14:58
1

This might do the trick

\setlength{\cftfignumwidth}{\dimexpr\mylenf+2em}
\setlength{\cfttabnumwidth}{\dimexpr\mylenf+2em}
\renewcommand\cftfigaftersnum{\enspace--\enspace}
\renewcommand\cfttabaftersnum{\enspace--\enspace}

Since Table is shorter than Figure is does not quite line up. The main problem here is that the material (the number and the title) is handed over to the typesetting macro as a single construction. Similar to

\numberline{number}Title

Where the \numberline is giving the box of a certain width.

  • Indeed! Thanks a lot, you really save my work! – DiegoMath Jul 1 '14 at 15:10
1

Add something like

\renewcommand{\cftfigaftersnum}{ -- }
\renewcommand{\cfttabaftersnum}{ -- }

in the preamble. So you get enter image description here

  • It works too, thanks for colaborate with the answer! – DiegoMath Jul 1 '14 at 15:42

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.