Re: Is it possible to know if there are any figures / tables in a document?
- From: Pep Navarro <pep.navarro@xxxxxxxxx>
- Date: Thu, 27 Nov 2008 11:20:53 +0100
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,redefine \listof... a bit such that they process the contents of the
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.
.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.
.
- Follow-Ups:
- References:
- Is it possible to know if there are any figures / tables in a document?
- From: Pep Navarro
- Re: Is it possible to know if there are any figures / tables in a document?
- From: Lars Madsen
- Re: Is it possible to know if there are any figures / tables in a document?
- From: Pep Navarro
- Re: Is it possible to know if there are any figures / tables in a document?
- From: Lars Madsen
- Is it possible to know if there are any figures / tables in a document?
- Prev by Date: Re: Is it possible to know if there are any figures / tables in a document?
- Next by Date: Re: Is it possible to know if there are any figures / tables in a document?
- Previous by thread: Re: Is it possible to know if there are any figures / tables in a document?
- Next by thread: Re: Is it possible to know if there are any figures / tables in a document?
- Index(es):
Relevant Pages
|