I am using
\usepackage{imakeidx}
\usepackage{hyperref}
and the command \listoffigures
to get the list of figures. Some figures are double-column, some are single-column, and LaTeX does not always place them consecutively.The figures are ordered by page as usual in the list of figures.
However, I would prefer to have the list sorted by Figure number rather than page number, and with the number of figures I am using it would be impractical to change the numbers of any of the figures.
This is a view of the first two pages of the List of Figures:
Note the incorrect figure number order when sorted by page (page 28).
Can this be changed? How?
Best Answer
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 (nowfixltx2e
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.