3

My problem is not exactly creating the list, but I create it according to the norms of my country. The list should look like this

Figure 1 - Caption (white space or dotted) 6

It should start with the word figure followed by its numbering, then a dash, then its caption and in the right corner of the page the number of the page where it appears.

There is a class called abntex2 that does this, but I could not make it work using the book class. Some commands contained in the abntex2 class that are related to the list of figures are

\renewcommand{\cftfigurename}{\figurename\space}
\renewcommand*{\cftfigureaftersnum}{\hfill\textendash\hfill}

Add un minimal code (need any figure called 1)

\documentclass{book}
\usepackage{hyperref}
\usepackage{graphicx}
\renewcommand{\cftfigurename}{\figurename\space}
\renewcommand*{\cftfigureaftersnum}{\hfill\textendash\hfill}

\begin{document}

\pdfbookmark[0]{\listfigurename}{lof}%need \usepackage{hyperref}
\listoffigures*
\cleardoublepage

\begin{figure}
\includegraphics[width=\linewidth]{1}
\caption{Test}
\end{figure}

\end{document}
  • 1
    What class are you using currently (or want to use)? – Werner Feb 14 '18 at 17:22
  • 1
    As a Brazilian, I am shame because of this absurd rules in abnt. – Sigur Feb 14 '18 at 17:25
  • 1
    These are commands from tocloft. Try loading it and add these commands to your preamble. Do you want page number to be right after captions or at the end of lines, with one figure per line? – Bernard Feb 14 '18 at 17:25
  • 1
    I don't see what's so absurd. Each country has its own typographical rules. – Bernard Feb 14 '18 at 17:27
  • 1
    @Bernard, just my opinion. But when we read all the rules, we start to be crazy. Specially to format the text in TeX. – Sigur Feb 14 '18 at 17:29
5

Here is a way. I supposed you won't have more than 99 figures (one has to compute the width of the label in the list of figures). I also added the emptypage package, to have no header/footer on empty pages.

Also, as mentioned by @ChristianHupfer, the hand-made \pdfbookmark[0]{…} can be replaced with loading package tocbibind with option [notoc] so that the table of contents does not refer to itself.

\documentclass{book}
\usepackage{showframe} 
\renewcommand{\ShowFrameLinethickness}{0.3pt}
\usepackage{graphicx}
\usepackage{calc}
\usepackage{tocloft}
\usepackage[nottoc]{tocbibind}
\usepackage{emptypage}
\usepackage{hyperref}

\renewcommand*{\cftfigname}{\figurename\space}
\renewcommand*{\cftfigaftersnum}{~\textendash\hfill}
\renewcommand{\cftfigpresnum}{\cftfigname}
\setlength{\cftfigindent}{0pt}
\setlength{\cftfignumwidth}{\widthof{\cftfigname 00~\textendash~}}

\begin{document}

\pagestyle{plain}

\tableofcontents
\listoffigures
\cleardoublepage
\setcounter{figure}{49}

\chapter{Some Chapter}

\begin{figure}
\includegraphics[width=\linewidth]{example-image}
\caption{Test}
\end{figure}

\end{document} 

enter image description here

  • 1
    You beat me by a few seconds. You could use \usepackage[nottoc]{tocbibind} to get rid of that weird manual \pdfbookmark stuff. – user31729 Feb 14 '18 at 19:46
  • 1
    Done, mylord ! – with due credits. That is a really useful comment, as I hadn't tested what happens in the table of contents. – Bernard Feb 14 '18 at 20:18
  • I can't upvote twice, however ;-) – user31729 Feb 14 '18 at 21:37
  • @Bernard Thank you very much. I was able to make the list of tables using the same commands, I just substituted fig by tab. – Marcelo Rodrigues Feb 16 '18 at 13:21
  • 1
    @ChristianHupfer: Sorry. One of my many typos – unless it was a lapsus calami: perhaps it subconsciously stood for ὑπέρ ;o) – Bernard Mar 1 '18 at 21:14

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.