Re: Is it possible to know if there are any figures / tables in a document?



Lars,

thanks again for your quick answer.

I'm using the book style as a base. However, I'm afraid this problem is
taking too much of your time! I have devised a simple, although not so
clean solution:

\def\makeContentsPages#1#2
{
\tableofcontents
\if#1\empty\else\listoffigures\fi
\if#2\empty\else\listoftables\fi
}

The user of this macro simply has to "check" whether he/she wants the
list of figures and/or tables, as for instance:

\makeContentsPage{}{x}

Here, the table of contents and the list of tables are generated, but
the list of figures is ignored.

I know, this is neither a clean solution nor automatic, but it will do.
At least, the several "contents" pages will be created in the order the
guidelines state and the user has the option to enable / disable the
pages that would be empty...

Thanks again.

Pep.

Lars Madsen escribió:
Pep Navarro wrote:
Lars,

Thanks alot for your suggestion. However, it is too complicated for me
(I'm quite a beginner with TeX / LaTeX).

Instead, I wonder if it is possible to test a figure or table counter in
a way that would look like this:

\ifnum\THEFIGURECOUNTER > 0
\listoffigures
\fi


it starts at zero at the start of the document and is often reset at the
begininng of each chapter, so that is no good.

You could overload \caption instead, again that is complicated.

Which document class are you using or using as a base?

In order to do what I suggested, we need to activate the LoT and LoF,
and thus is a little easier to create a solution if I know what I have
to use as a base.

The idea is to activate the LoT and Lof such that the .lot and .lof
files are created. Looking at, say figure, we know that the entries is
typeset by \l@figure{...}{...}, and so we can locally change that and
count the number of entries.


Does such a counter exist?

Thanks again.

Pep.

Lars Madsen escribió:
Pep Navarro wrote:
Hi,

Perhaps my question is not clear enough, but the subject field is too
short to express the idea.

Some colleagues in my company have to prepare courses every now and
then. Of course, we have some guidelines to follow but no LaTeX
style to
enforce them.

Now I'm preparing such a style. Then, I want to prepare a macro, namely

\makeContentsPages

that would look like this:

\def\makeContentsPages
{
\tableofcontents
\listoffigures
\listoftables
}

Pretty stupid, isn't it? Well, the reason to prepare such a macro is to
make sure everyone creates the TOC, list of figures and tables and that
he/she does it in this precise order (let's say to enforce homogeneity)

The problem is that if there are no, let's say, figures in a document,
such a macro would produce a page with the header "List of figures" and
nothing else, which is quite awful. The same applies to the list of
tables.

Then, my question: is there any way to ascertain the number of figures
and tables in a document, so I can check whether to invoke
\listoffigures and \listoftables?

Thanks alot.

Pep.

redefine \listof... a bit such that they process the contents of the
.lof and .lot twice. First run will look for entries, second run only if
there are any entries.

I do this in my LaTeX book to automatically adjust the widths of the
page field and chapternumber field.








.



Relevant Pages

  • Re: Auto Text or Auto Correct Entries
    ... When I removed it from both locations the macro warning went away, ... use an older Auto text entry from the normal.dot template. ... entries are automatically carried forward to the new version. ... If they're moving to new computers rather than upgrading an existing ...
    (microsoft.public.word.docmanagement)
  • Re: ?s while building a macro using Find or building a form
    ... Meanwhile I continued to work on my macro. ... 'parse doc looking for trigger to new entry ... entries have two sets of letters, because the I didn't find a means of ... "vabki" wrote: ...
    (microsoft.public.word.vba.general)
  • RE: ?s while building a macro using Find or building a form
    ... When I hadn't seen any responses by the end of the day I thought ... Meanwhile I continued to work on my macro. ... 'parse doc looking for trigger to new entry ... entries have two sets of letters, because the I didn't find a means of ...
    (microsoft.public.word.vba.general)
  • Re: Setting character colour in a macro
    ... > The trick in this one is not really in the macro. ... difficult is that the end result I want is really based on ISP address ranges. ... It would be easy to program a macro to colour multiple entries from a single IP ...
    (microsoft.public.excel.misc)
  • Re: Double-spacing in List of Figures and List of Tables
    ... Steve Hicks writes: ... This simple solution still adds extra space between entries when the ... Do anyone know how to get rid of that for the LOT and LOF? ...
    (comp.text.tex)