How can I create a List of Figures which has captions and page numbers, but no figure numbers?
[Tex/LaTex] List of figures without figure numbers
numberingtable of contents
Related Solutions
Of course, David Carlisle has already mentioned in a comment the correct solution, which is to use the fixltx2e
package or a new enough LaTeX kernel (now fixltx2e
changes are applied by default). Among other goodies, this will ensure that figures appear in the same order in the output as you specified them in the input.
If, however, you like how LaTeX does it by default, outputting single and double-column figures in independent orders, it is possible to only sort the list of figures by figure number, without changing the output in the main part of the document. The code below does this by ordering lines of the lof
file just before \listoffigures
is called. The key used to sort is the second item of the second argument of \contentsline
, which happens to be the figure number. One could use similar code to sort figures by caption, or whatever other criterion you like.
\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{imakeidx}
\usepackage{hyperref}
\usepackage{lipsum}
%%%%%%%%%%%%%%%%%%% Sorting a file
\usepackage{catchfile}
\usepackage{expl3, xparse}
\ExplSyntaxOn
\tl_new:N \l_sortfile_tl % The contents of file #1.
\seq_new:N \l_sortfile_seq % The contents, split at the delimiter #2.
\tl_new:N \l_sortfile_first_tl % Part of the file #1 before first #2.
\iow_new:N \l_sortfile_iow % The output goes there.
\tl_new:N \l_sortfile_a_tl % Used for sorting
\tl_new:N \l_sortfile_b_tl % Used for sorting
\cs_new_protected:Npn \sortfile:nnn #1#2#3
{
\IfFileExists {#1}
{ \CatchFileDef { \l_sortfile_tl } {#1} { } }
{ }
\seq_set_split:NnV \l_sortfile_seq {#2} \l_sortfile_tl
\seq_pop:NN \l_sortfile_seq \l_sortfile_first_tl
\seq_sort:Nn \l_sortfile_seq { #3 {##1} {##2} }
\iow_open:Nn \l_sortfile_iow {#1}
\tl_if_empty:NF \l_sortfile_first_tl
{ \iow_now:Nx \l_sortfile_iow { \exp_not:V \l_sortfile_first_tl } }
\seq_map_inline:Nn \l_sortfile_seq
{ \iow_now:Nn \l_sortfile_iow { #2 ##1 } }
\iow_close:N \l_sortfile_iow
}
\cs_new_protected:Npn \sortfile_contents_sort:nn #1#2
{
\tl_set:Nx \l_sortfile_a_tl { \tl_item:nn {#1} {2} }
\tl_set:Nx \l_sortfile_b_tl { \tl_item:nn {#2} {2} }
\int_compare:nNnTF
{ \tl_item:Nn \l_sortfile_a_tl {2} }
> { \tl_item:Nn \l_sortfile_b_tl {2} }
{ \sort_return_swapped: }
{ \sort_return_same: }
}
\DeclareDocumentCommand{\sortfile}{mmm}
{ \sortfile:nnn {#1} {#2} {#3} }
\DeclareDocumentCommand{\contentssort}{mm}
{ \sortfile_contents_sort:nn {#1} {#2} }
\ExplSyntaxOff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\sortfile{\jobname.lof}{\contentsline}{\contentssort}
\listoffigures
\twocolumn
\lipsum[1-5]
\begin{figure}\footnotesize\lipsum[2]\caption{First figure}\end{figure}
\lipsum[6]
\begin{figure*}\footnotesize\lipsum[2]\caption{Second figure}\end{figure*}
\lipsum[7]
\begin{figure}\footnotesize\lipsum[2]\caption{Third figure}\end{figure}
\lipsum[8]
\begin{figure}\footnotesize\lipsum[2]\caption{Fourth figure}\end{figure}
\lipsum[9-15]
\end{document}
To use different captions for the same float use the optional argument
\caption[<opt>]{<main>}
So the <opt>
will be used in the List of... and the <main>
will be used together the float.
Best Answer
The easiest answer is
but of course this won't suppress the figure numbers in the captions to the figures.
A more complicated setting with tocloft that allows to better control the appearance is
In this way the captions will start flush with the left margin.