4

I would like to have a list of tables and figures with their page numbers.

Using:

\listoffigures
\listoftables

will produce a list like below:

List of Tables
Table#  Caption ................. Page#
Table#  Caption ................. Page#

But I would like to have:

List of Tables
Table# .......................... Page#
Table# .......................... Page#

I appreciate any help.

  • 3
    Quick hack: \caption[]{your caption text} – user36296 Apr 16 '17 at 22:01
  • Welcome to TeX.SX! In order to be able to tell you how to remove the captions from the list of tables by changing some parameter in the preamble, you have to tell us your settings, in particular your document class. Please provide a complete small document (starting with \documentclass and ending with \end{document}) that contains the main features of your document and that can be compiled. – gernot Apr 16 '17 at 22:06
  • @samcarter: Could get tedious ;-) – user31729 Apr 16 '17 at 22:10
  • @samcarter I tried this before posting the question but in my case that will remove the table/figure from the list. \caption[ ]{your caption test} (with a whitespace) would work though. – Farshid.T Apr 17 '17 at 11:22
  • @ChristianHupfer "global replace" is a nice thing to have. But apparently the hack is not even working, so big fail :) – user36296 Apr 17 '17 at 11:25
5

A quick hack with redefinition of \caption.

If the \ifnumberonly boolean test is true, then the usual caption content is displayed in the body but omitted in the Lof or LoT

Say \numberonlytrue to enable the 'easy' display in the LoT or \numberonlyfalse for the usual content.

\documentclass{book}

\usepackage{pgffor}


\usepackage{xparse}

\newif\ifnumberonly
\numberonlytrue

\makeatletter
\let\caption@@orig\caption

\RenewDocumentCommand{\caption}{som}{%
  \IfBooleanTF{#1}{%
    \caption@@orig*{#3}%
  }{%
    \ifnumberonly
    \caption@@orig[]{#3}
    \else
    \IfValueTF{#2}{%
      \caption@@orig[#2]{#3}
    }{%
      \caption@@orig{#3}
    }%
    \fi
  }%
}
\makeatother



\begin{document}

\listoftables
\listoffigures
\foreach \x in {1,...,20}{%
\begin{figure}
  \caption{Figure \x\ but you won't see this}
\end{figure}

\begin{table}
  \caption{Table \x\ but you won't see this}
\end{table}

}

\end{document}

enter image description here

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.