[OS X TeX] Writing an abstract book and custom index

Ross Moore ross at ics.mq.edu.au
Thu Mar 25 19:49:09 EST 2004

Hi Kip,

On 26/03/2004, at 1:04 AM, Kip Bishofberger wrote:
> That's a very impressive book of abstracts (and, frankly, a pretty
> fun conference... some cool talks).  I have wanted array variables
> (in tex) for my thesis figures.  I want to just type:
>   "...If you look at \fig\quadratic, you can see a
>   quadratic.\plot\quadratic"

You want to organise your coding along the following lines:


... continued below ...

> Then I'd have some other database file that has entries like
> (warning: fake, array-like tex ahead.  proceed with caution):
>     quadratic={3.12,quad.png,4in,This is a quadratic function.}
>     cubic    ={3.13,qbic.png,4in,This is a cubic function.}
> And a couple general definitions (note #1[1] refers to the first
> item in the above list (3.12), #1[2] the second, etc):
>     \def\fig#1{Figure~#1[1]}
>     \def\plot#1{\topinsert{\includegraphics[width=#1[3]]
>                 {figures/#1[2]}}\caption#1}
>     \def\caption#1{Figure #1[1]: #1[4]}

	Figure \thisfigref: \thisfigcaption
	\label{\thisfigref}}% end of \topinsert

   ... parse the information for #1  e.g.  \quadratic, \cubic etc.
       to result in definitions, such as:
   \def\thisfigref{...1st item in the list...}%
   \def\thisfigname{...2nd item in the list...}%
   \def\thisfigwidth{...3rd item in the list...}%
   \def\thisfigcaption{...4th item in the list...}%

> Basically, it's the #1[1] part that I can't do.  I know about
> case statements, but they don't scale well to nearly 100 figures.

Separate the tasks of:
   1. reading information from your database
   2. placing material onto the page.

In my coding-outline above, task 1. is done by
the  \setupfigure  command, which you will need to
customise to match the way you supply the information
to your TeX job. Note how it starts with \begingroup,
so that the subsequent definitions of \thisfigref, etc.
are localised for the particular usage...

  ... the corresponding \endgroup being provided by the
\insertfigref  or  \insertplot  command,
which does the task 2. of putting material onto the page.

It is now very easy to write more kinds of actions that
insert stuff from the database data in new ways.

Note that I've included use of LaTeX's \label and \ref
mechanism, so that (using hyperref.sty) you can make these
into active hyperlinks in the resulting PDF.
(Indeed, you seem to be using Plain TeX where there is
already good LaTeX coding that can be used.)
In particular, you seem to be assigning specific numbering,
which could be done instead using counters in LaTeX,
and symbolic labels instead of fixed strings.

> If you, Ross, or anyone else can show me an example of a
> "friendly" database system, I'd be oh so grateful.

Personally, I don't use a specialised data-base system.

Instead I write my own Perl programs to extract data from
text-only record files, and to write out the TeX coding
that will be used as \input or \include'd files for
pdf-(La)TeX jobs.

Hope this helps,


> kipster
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia                                  fax: +61 +2 9850 8114

Please see <http://www.esm.psu.edu/mac-tex/> for list
guidelines, information, and LaTeX/TeX resources.

More information about the MacOSX-TeX mailing list