[OS X TeX] Accessing certain fields in a BibTeX-entry directly "in place"

Josep M. Font jmfont at inicia.es
Thu Mar 16 11:47:16 EST 2006


El 16/03/2006, a las 13:09, Daniel Käsmayr escribió:

> Dear Folks,
>
> I am not sure if what I am trying to accomplish is even possibly as  
> I really haven’t digested all there is to TeX (yet ;)).
[snip]
> The background for this is: I am writing my thesis in chemistry and  
> would like to have some sort of index of my chemical compounds  
> which all have a short name, a long name, my internal name (i.e.  
> label), have characteristics such as molecular weights, have  
> associated sections in the text where they are mentioned - etc; and  
> I would love to have a list of all these compounds in my appendix -  
> including graphics etc.
[snip]
> Am I making sense? Has anyone heard of such a thing being done in  
> LaTeX before?

A very different approach is to use some tricky macros and build some  
data-base-like macros which you can then use at your liking. Examples:

On the one hand, for each of your chemical compounds you "define" its  
LABEL as a control sequence, and you include there all the  
information concerning it; for instance:

\def\LABEL{\def\shortname{SHORT NAME}\def\longname{LONG NAME}}% etc.

Replace the capitals by the real contents; include as many  
"categories" (\shortname, \longname, etc.) as you need. You do this  
for each of your compounds, thus obtaining a kind of "data-base". The  
contents of each of the "categories" can be arbitrary TeX code, as  
you like, e.g., a {figure} environment to print a graphics, or a \ref 
{...} macro to cite the section, etc.

On the other hand, for each of the "categories" you define a macro  
that "prints" its contents, in this way:

\def\printshortname #1{\csname #1\endcsname\shortname}
\def\printlongname #1{\csname #1\endcsname\longname}

etc.

Now you can say e.g. \printshortname{LABEL} and TeX will print the  
SHORT NAME corresponding to this LABEL, etc. You can use these last  
macros (never directly \LABEL) in all places in your document, and  
notably in order to create a list or index. It remains to think a  
practical way of creating this list; with my suggestion, you have to  
manually replicate the basic layout for each of your compounds (I  
would define a macro \indexlayout{LABEL} and then just put one  
\indexlayout for each of the compounds...).

If you get the basic idea, then you have to be careful not to use  
control sequences with conflicting names, etc., and use names you  
like more for the often-used ones, e.g. perhaps you prefer \psn  
instead of \printshortname, etc.

Sorry if I have been unclear. I am sure there are more effective ways  
of materializing my idea, and the TeX wizards of the list will  
correct me.

Hope this helps,

JMaF

------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the MacOSX-TeX mailing list