The differences between the figure and table environments are very minor -- little more than them using different counters, and being maintained in separate sequences.
That is, there's nothing stopping you putting your {tabular}
environments in a {figure}
, or your graphics in a {table}
, which would mean that they'd end up in the same sequence. The problem with this case (as Joseph Wright notes) is that you'd have to adjust the \caption
, so that doesn't work perfectly.
Try the following, in the preamble:
\makeatletter
\newcounter{unisequence}
\def\ucaption{%
\ifx\@captype\@undefined
\@latex@error{\noexpand\ucaption outside float}\@ehd
\expandafter\@gobble
\else
\refstepcounter{unisequence}% <-- the only change from default \caption
\expandafter\@firstofone
\fi
{\@dblarg{\@caption\@captype}}%
}
\def\thetable{\@arabic\c@unisequence}
\def\thefigure{\@arabic\c@unisequence}
\makeatother
Then use \ucaption
in your tables and figures, instead of \caption
(change the name ad lib). If you want to use this same sequence in other environments (say, listings?), then define \the<foo>
the same way.
My earlier attempt at this is in fact completely broken, as the OP spotted: the getting-the-lof-wrong is, instead of being trivial and only fiddly to fix, absolutely fundamental (ho, hum).
(For the afficionados, it comes about because \advance
commands are processed in TeX's gut, but the content of the .lof, .lot, and .aux files is fixed in TeX's mouth, at expansion time, thus what was written to the files was whatever random value \@tempcnta
had at the point \caption
was called, ignoring the \advance
calculations, which were then dutifully written to the file, and then ignored. Doh: how long have I know this but never internalised it!?)
Dutiful retention of earlier attempt (on the grounds that it may be instructively wrong):
No problem: try putting the following in the preamble:
\makeatletter
\def\tableandfigurenum{\@tempcnta=0
\advance\@tempcnta\c@figure
\advance\@tempcnta\c@table
\@arabic\@tempcnta}
\let\thetable\tableandfigurenum
\let\thefigure\tableandfigurenum
\makeatother
...and then use the {table}
and {figure}
environments as normal. The captions will have the correct 'Table/Figure' text, but they'll share a single numbering sequence.
Note that this example gets the numbers wrong in the listoffigures/listoftables, but (a) you say you don't care about that, (b) it's fixable, though probably mildly fiddly, and (c) life is hard!