[texhax] BibTex String change

Pavel Minev Penev pavpen at berkeley.edu
Thu Jul 29 17:08:40 CEST 2004


On Wed, Jul 28, 2004 at 05:48:45PM +0200, fg8x010 wrote:
> For a biological article I need empasized biological names in the 
> bibliography
> as well (e.g. "On the development of {\EM Calanus finmarchicus}")
> How can I emphasize single keywords in the BibTex-file?
> something like:
> 
> keyword-list:
> name1
> name2
> ...
> FUNCTION {format.keyword}
> { keyword emphasize
> }
> for all keywords

Consider BibTool --- much better than looking below:

I am sorry to re-post this message of mine, but it seems not to be
usable from the archives:

On Wed, May 05, 2004 at 05:21:45PM -0700, Pavel Minev Penev wrote:
> On Tue, May 04, 2004 at 01:43:30PM -0700, Pavel Minev Penev wrote:
> > Alternatively, you can write a short style definition (``.bst'') that
> > does the same job (expands variables, or replaces strings in particular
> > fields of the ``.bib'' database with desired values).
> 
> OK.  Here is a some ``.bst'' code that is able to string substitution in
> strings.
> 
> Tue, 04 May 2004 17:25:04 -0500 Sebastian Luque <sluque at mun.ca>:
> > database as raw as possible. I'd love to try your code and see if I can
> > come up with a way of building 'string' commands that do the opposite of
> > what the documentation shows; i.e. create journal abbreviations from the
> > full names as they appear in the database, something like:
> >                                                                               
> > @string{Journal of Physiology = "J. Physiol."}
> >                                                                             
> > I also don't seem to understand how to make a style strip all the
> > periods in such an abbreviation, e.g. J Physiol
> 
> The code can do any string substitution in a desired string field.
> 
> > Hopefully I'll be able to figure it out from your code. I have a file
> > with all journal abbreviations, in the form:
> >                                                                            
> > journal abbreviation  \tab  full journal name
> > 
> > that I could probably manipulate with it. I'd also greatly appreciate a
> > tip on how to run the code, as all I know in LaTeX is use the commands
> 
> What I have come up with is the following scheme:
> 
> You add "@meta:..." entries in the database to configure the style where
> "..." can be "author", "title", etc depending on what field you want to
> configure.  (I know style-related materias should not have anything to
> do with the database, but having to use specific @STRING{ abbev =
> "Full-name" } that the ``.bst'' understands in no less style-specific).
> 
> Currently the only field understood in "@meta:..." entries is "abbrev".
> It specifies what string substitutions should be done on the respective
> field.  For example
> 
> 	@meta:publisher {, % Key has no meaning for us.
> 		abbrev = "",
> 	}
> 
> specifies what string substitutions should be done on the publisher
> field of each entry.  The format of the "abbrev" field is a bit awkward.
> The field contains a list of an even number of elements that is
> interpreted as a list of couples.  Each couple contains two strings:
> substring to substitute, and substitution.  The elements of the "abbrev"
> list are separated by "# -> #" (BibTeX converts multiple tabs and spaces
> to a single one, so you can make use of that).  The list may optionally
> end in "# -> #".  You should be careful not to include leading or
> trailing spaces in the list elements, or you may get undesired results.
> Example:
> 
> 	@meta:journal {,
> 		abbrev = "Journal of Physiology# ->	#J Physiol# -> #" #,
> 			 "Journal of Long Names for BiBTeX Files" #
> 			 	"# -> #J Long# -> #",
> 	}
> 
> will substitute "J Physiol" for "Journal of Physiology" and "J Long" for
> "Journal of Long Names for BiBTeX Files" anywhere in any journal field.
> 
> 
> How to Add Abbreviation Capabilities to Style Files
> ---------------------------------------------------
> 
> Put the code between lines 19 and 364 near the beginning of the ``.bst''
> file (after the ENTRY section and the definition of common functions as
> not, and, or).  If the ``.bst'' already defines not, and, or or, remove
> one of the definitions (highly likely).  If the ``.bst'' file defines
> some of the string manipulation functions, you can reuse them.
> 
> Replace style's "address" by "filtered.address", "author" by
> "filtered.author", similarly prepend "filtered." to "booktitle",
> "chapter", "editor", "howpublished", "institution", "journal", "month",
> "note", "organization", "publisher", "school", "series", and "title".
> 
> Add the code between lines 385 and 393:
> 
> 	FUNCTION { meta.collect_meta_info }
> 	{
> 		type$ #1 #5 substring$ "meta:" =
> 		{ call.type$ }{}
> 		if$
> 	}
> 
> 	% Collect meta configuration:
> 	ITERATE {meta.collect_meta_info}
> 
> soon after the "READ" command (before ``.bst''s "EXECUTE", "ITERATE",
> "REVERSE" and "SORT" calls).
> 
> That should do it.
> 
> 
> Important Notice
> ----------------
> 
> The abbreviation module uses a lot (14) of global string variables
> (mainly to store "abbrev" lists).  This can easily cause BiBTeX to reach
> its limit of 20!?  In the case that you do reach the limit you can
> rewriting my code to reuse more of its string variables (5 used, two or
> three can be cut down, or even more if you use ``.bst''s).  If that is
> not enough you can remove some of the "*.Abbrev" variables and
> "filtered.*" functions for the fields you do not perform abbreviation
> upon.  (I'm using 19 out of 20 varables, so . . .)
> 
> 
> Warning:  The code is not tested with all fields, or extensively at all.
> Consider it alpha!
> 	  The string substitution mechanism is not very efficient, but
> hopefully, you will not have thousands of referencies with hundreds of
> abbreviations . . .

An updated version of the <.bst> code is attached.

Goodness,
-- 
Pav
  ,.,http://en.wikipedia.org/wiki/List_of_U.S._foreign_interventions_since_1945
,``:'', http://www.bilderberg.org/ccf.htm
{o ! o} 
] -+- [ http://www.againsttcpa.com/
 \ ! /  http://swpat.ffii.org/
  `-'   My type: Dvorak.
`shell$ gpg --keyserver x-hkp://search.keyserver.net:11371 --recv-key 164C028F`
-------------- next part --------------
ENTRY {
	address
	author
	booktitle
	chapter
	editor
	howpublished
	institution
	journal
	month
	note
	organization
	publisher
	school
	series
	title
	abbrev
}{}{ label extra.label sort.label short.list }

% 
% GLOBAL VARIABLES USED IN FUNCTIONS:
% 
% 
% Strings:
% 
% Make string reuising easy by wrapping string contents and string names in
% functions.  If you want to use different string global variables, simply
% redefine the wrapping functions accordingly.
STRINGS {str1 str2 str3 str4}

FUNCTION {index.srch_str}{ str1 }
FUNCTION {index.srch_str.strname}{ 'str1 }

FUNCTION {delimlist.pop_first.delim}{ str1 }
FUNCTION {delimlist.pop_first.delim.strname}{ 'str1 }

FUNCTION {abbreviate.abbrlist}{ str1 }
FUNCTION {abbreviate.abbrlist.strname}{ 'str1 }
FUNCTION {abbreviate.delim}{ str2 }
FUNCTION {abbreviate.delim.strname}{ 'str2 }
FUNCTION {abbreviate.abbrev}{ str3 }
FUNCTION {abbreviate.abbrev.strname}{ 'str3 }
FUNCTION {abbreviate.fulltext}{ str4 }
FUNCTION {abbreviate.fulltext.strname}{ 'str4 }

% 
% Integers:
% 
INTEGERS {str.rawlen.i}
INTEGERS {rtrim.strlen}
INTEGERS {index.i index.end_i index.srch_str.len}
INTEGERS {delimlist.pop_first.item2_i}
INTEGERS {abbreviate.len}

FUNCTION {Abbrev.Delim}{ "# -> #" }
FUNCTION {Meta.Do_Debug}{ #0 }

FUNCTION {not}
{
	{ #0 }{ #1 } if$
}

FUNCTION {and}
{
	'skip$ { pop$ #0 } if$
}

FUNCTION {or}
{
	{ pop$ #1 } 'skip$ if$
}

% String length, regarding braces and backslashes as usual characters:
FUNCTION {str.rawlen}
{
	duplicate$
	text.length$ #1 + 'str.rawlen.i :=
	{ duplicate$ str.rawlen.i #1 substring$ "" = not }
	{
		str.rawlen.i #1 + 'str.rawlen.i :=
	}
	while$
	pop$
	str.rawlen.i #1 -
}

FUNCTION {ltrim}
{
	duplicate$
	empty$
	{
		pop$
		""
	}{
		{ duplicate$ duplicate$ empty$ not swap$
		#1 #1 substring$ empty$ and }
		{
			#2 global.max$ substring$
		}
		while$
	}
	if$
}

FUNCTION {rtrim}
{
	duplicate$
	empty$
	{
		pop$
		""
	}{
		duplicate$ str.rawlen 'rtrim.strlen :=
		{ duplicate$ #-1 #1 substring$ empty$ }
		{
			rtrim.strlen #1 - 'rtrim.strlen :=
			#1 rtrim.strlen substring$
		}
		while$
	}
	if$
}

% Return the index of the first occurrence of the first argument in the
% second argument:
FUNCTION {index}
{
	Meta.Do_Debug #2 >
	{
		"index: index.srch_str = " index.srch_str * top$
		"index: index.srch_str.len = " index.srch_str.len
			int.to.str$ * top$
		"index: index.i = " index.i int.to.str$ * top$
		"index: index.end_i = " index.end_i int.to.str$ * top$
	}{}
	if$
	
	index.srch_str.strname :=
	
	% Debugging:
	Meta.Do_Debug #1 >
	{
		"index: Searched: " index.srch_str * top$
		duplicate$ "index: Search in: " swap$ * top$
	}{}
	if$
	
	index.srch_str str.rawlen 'index.srch_str.len :=
	duplicate$ str.rawlen index.srch_str.len - #2 + 'index.end_i :=
	#1 'index.i :=
	% Should-extit flag:
	#0
	{	% Test should-exit flag:
	  	{
			#0
		}{
			index.i index.end_i <
			{ #1 }{ pop$ #0 #0 } if$
		}
		if$
	}
	{
		duplicate$
		index.i index.srch_str.len substring$ index.srch_str =
		{
			pop$
			index.i
			#1 % should-exit flag.
		}{
			index.i #1 + 'index.i :=
			#0 % should-exit flag.
		}
		if$
	}
	while$
	
	% Debugging:
	Meta.Do_Debug #2 >
	{
		duplicate$ int.to.str$ "index: Index: " swap$ * top$
	}{}
	if$
}

% Strore a delim list in the format:
%	"item1<delim>item2<delim>item3..."

% Pop a delimiter and a delim list and push the list with its first item
% removed and the first item.
% 	"item1<delim>item2<delim>item3..." "<delim>" delimlist.pop_first
%   Results in:
% 	"item2<delim>item3..." "item1"
FUNCTION {delimlist.pop_first}
{
	% Save variables:
	delimlist.pop_first.delim.strname :=
	
	% Debugging:
	Meta.Do_Debug #1 >
	{
		duplicate$ "delimlist.pop_first: List: " swap$ * top$
		"delimlist.pop_first: Delim: " delimlist.pop_first.delim * top$
	}{}
	if$
	
	duplicate$
	delimlist.pop_first.delim index 'delimlist.pop_first.item2_i :=
	delimlist.pop_first.item2_i
	{
		duplicate$
		delimlist.pop_first.item2_i index.srch_str.len +
			global.max$ substring$
		swap$
		#1 delimlist.pop_first.item2_i #1 - substring$
	}{
		""
		swap$
	}
	if$
	
	% Debugging:
	Meta.Do_Debug #1 >
	{
		duplicate$ "delimlist.pop_first: Item: " swap$ * top$
		swap$
		duplicate$ "delimlist.pop_first: New List: " swap$ * top$
		swap$
	}{}
	if$
}

% Arguments:
% 
% Arg 1: Delimiter used in below list.
% Arg 2: A delim list with even number of elements interpreted as
% 	 abbreviation-full-name pairs.
% Arg 3: String to perform abbreviation over.
%
% Result:
% 
% String in arg. 3 with abbreviations substituted.
FUNCTION {abbreviate}
{
	abbreviate.delim.strname :=
	abbreviate.abbrlist.strname :=
	% Debug:
	Meta.Do_Debug
	{
		duplicate$ "abbreviate: Abbreviating: " swap$ * top$
		"abbreviate: According to " abbreviate.abbrlist * top$
		"abbreviate: Delimited by " abbreviate.delim * top$
	}{} if$
	"" swap$
	{ duplicate$ empty$ not }
	{
		abbreviate.abbrlist swap$
		% Loop exit flag:
		#0
		{
			{
				#0
			}{
				abbreviate.abbrlist empty$
				{
					duplicate$
					#1 #1 substring$ swap$
					#2 global.max$ substring$
					#0
				}{
					#1
				}
				if$
			}
			if$
		}
		{
			abbreviate.abbrlist abbreviate.delim
				delimlist.pop_first
			abbreviate.abbrev.strname :=
			abbreviate.delim delimlist.pop_first
			abbreviate.fulltext.strname :=
			abbreviate.abbrlist.strname :=
			
			% Debug:
			Meta.Do_Debug #1 >
			{
				"abbreviate: abbreviate.fulltext = "
					abbreviate.fulltext * top$
				"abbreviate: abbreviate.abbrev = "
					abbreviate.abbrev * top$
				"abbreviate: abbreviate.abbrlist = "
					abbreviate.abbrlist * top$
			}{}
			if$
			
			abbreviate.fulltext str.rawlen 'abbreviate.len :=
			duplicate$ #1 abbreviate.len substring$
			Meta.Do_Debug #1 > {
				duplicate$ "abbreviate: Testing at: " swap$ *
					top$
			}{} if$
				abbreviate.fulltext =
			{
				% Debug:
				Meta.Do_Debug #1 >
				{ "abbreviate: Match." top$ }{} if$
				abbreviate.len #1 + global.max$ substring$
				abbreviate.abbrev swap$
				#1
			}{
				#0
			}
			if$
		}
		while$
		abbreviate.abbrev.strname :=
		swap$ abbreviate.abbrlist.strname :=
		*
		Meta.Do_Debug #1 > {
			duplicate$ "abbreviate: Abbreviated portion: " swap$ *
				top$
			"abbreviate: Unabbreviated portion: " abbreviate.abbrev
				* top$
		}{} if$
		abbreviate.abbrev
	}
	while$
	pop$
	Meta.Do_Debug
	{
		duplicate$ "abbreviate: Result: " swap$ * top$
	}{} if$
}

% 
% ABBREVIATIONS:
% 
% Comment out strngs and "filtered." functions (or at least their contents)
% below for fields you are not going to abbreviate.
% 
% String Memory Management:
% 
% You can strore multiple strings into one BibTeX varable by concatenating them
% and later using the respective substring of the varable.  For this purpose
% you will need to record the starting index and length of each string.  This
% makes for two integers per string, but BibTeX allows a much larger number of
% integer global varables than string ones.  Also bear in mind that normally
% BibTeX allows strings to be no longer than 5000 characters.
% 
% We use wrapping functions to access and store the strings for maximum
% flexibility.

STRINGS {	Institution.Abbrev
		Journal.Abbrev
		Month.Abbrev
		Organization.Abbrev
		Publisher.Abbrev
		School.Abbrev
	}

% Wrapper functions to store stack's top string into a ".Abbrev" variable:
FUNCTION { Institution.Abbrev.store }{ 'Institution.Abbrev := }
FUNCTION { Journal.Abbrev.store }{ 'Journal.Abbrev := }
FUNCTION { Month.Abbrev.store }{ 'Month.Abbrev := }
FUNCTION { Organization.Abbrev.store }{ 'Organization.Abbrev := }
FUNCTION { Publisher.Abbrev.store }{ 'Publisher.Abbrev := }
FUNCTION { School.Abbrev.store }{ 'School.Abbrev := }

% Store Address.Abbrev, Author.Abbrev, Booktitle.Abbrev, Chapter.Abbrev,
% Editor.Abbrev, HowPublished.Abbrev, Note.Abbrev, Series.Abbrev and
% Title.Abbrev in one string.  Integers initialized in meta.abbrev.init.
STRINGS {Meta.Abbrev.Pool1}
INTEGERS {Meta.Abbrev.Pool1.next_i}
INTEGERS {	Address.Abbrev.start_i		Address.Abbrev.len
		Author.Abbrev.start_i		Author.Abbrev.len
		Booktitle.Abbrev.start_i	Booktitle.Abbrev.len
		Chapter.Abbrev.start_i		Chapter.Abbrev.len
		Editor.Abbrev.start_i		Editor.Abbrev.len
		HowPublished.Abbrev.start_i	HowPublished.Abbrev.len
		Note.Abbrev.start_i		Note.Abbrev.len
		Series.Abbrev.start_i		Series.Abbrev.len
		Title.Abbrev.start_i		Title.Abbrev.len
	}

FUNCTION { Address.Abbrev }{
	Meta.Abbrev.Pool1 Address.Abbrev.start_i Address.Abbrev.len substring$
}
FUNCTION { Address.Abbrev.store }{
	Meta.Abbrev.Pool1.next_i 'Address.Abbrev.start_i :=
	duplicate$ str.rawlen 'Address.Abbrev.len :=
	Meta.Abbrev.Pool1.next_i Address.Abbrev.len +
		'Meta.Abbrev.Pool1.next_i :=
	Meta.Abbrev.Pool1 swap$ * 'Meta.Abbrev.Pool1 :=
}

FUNCTION { Author.Abbrev }{
	Meta.Abbrev.Pool1 Author.Abbrev.start_i Author.Abbrev.len substring$
}
FUNCTION { Author.Abbrev.store }{
	Meta.Abbrev.Pool1.next_i 'Author.Abbrev.start_i :=
	duplicate$ str.rawlen 'Author.Abbrev.len :=
	Meta.Abbrev.Pool1.next_i Author.Abbrev.len +
		'Meta.Abbrev.Pool1.next_i :=
	Meta.Abbrev.Pool1 swap$ * 'Meta.Abbrev.Pool1 :=
}

FUNCTION { Booktitle.Abbrev }{
	Meta.Abbrev.Pool1 Booktitle.Abbrev.start_i Booktitle.Abbrev.len
		substring$
}
FUNCTION { Booktitle.Abbrev.store }{
	Meta.Abbrev.Pool1.next_i 'Booktitle.Abbrev.start_i :=
	duplicate$ str.rawlen 'Booktitle.Abbrev.len :=
	Meta.Abbrev.Pool1.next_i Booktitle.Abbrev.len +
		'Meta.Abbrev.Pool1.next_i :=
	Meta.Abbrev.Pool1 swap$ * 'Meta.Abbrev.Pool1 :=
}

FUNCTION { Chapter.Abbrev }{
	Meta.Abbrev.Pool1 Chapter.Abbrev.start_i Chapter.Abbrev.len substring$
}
FUNCTION { Chapter.Abbrev.store }{
	Meta.Abbrev.Pool1.next_i 'Chapter.Abbrev.start_i :=
	duplicate$ str.rawlen 'Chapter.Abbrev.len :=
	Meta.Abbrev.Pool1.next_i Chapter.Abbrev.len +
		'Meta.Abbrev.Pool1.next_i :=
	Meta.Abbrev.Pool1 swap$ * 'Meta.Abbrev.Pool1 :=
}

FUNCTION { Editor.Abbrev }{
	Meta.Abbrev.Pool1 Editor.Abbrev.start_i Editor.Abbrev.len substring$
}
FUNCTION { Editor.Abbrev.store }{
	Meta.Abbrev.Pool1.next_i 'Editor.Abbrev.start_i :=
	duplicate$ str.rawlen 'Editor.Abbrev.len :=
	Meta.Abbrev.Pool1.next_i Editor.Abbrev.len +
		'Meta.Abbrev.Pool1.next_i :=
	Meta.Abbrev.Pool1 swap$ * 'Meta.Abbrev.Pool1 :=
}

FUNCTION { HowPublished.Abbrev }{
	Meta.Abbrev.Pool1 HowPublished.Abbrev.start_i HowPublished.Abbrev.len
		substring$
}
FUNCTION { HowPublished.Abbrev.store }{
	Meta.Abbrev.Pool1.next_i 'HowPublished.Abbrev.start_i :=
	duplicate$ str.rawlen 'HowPublished.Abbrev.len :=
	Meta.Abbrev.Pool1.next_i HowPublished.Abbrev.len +
		'Meta.Abbrev.Pool1.next_i :=
	Meta.Abbrev.Pool1 swap$ * 'Meta.Abbrev.Pool1 :=
}

FUNCTION { Note.Abbrev }{
	Meta.Abbrev.Pool1 Note.Abbrev.start_i Note.Abbrev.len substring$
}
FUNCTION { Note.Abbrev.store }{
	Meta.Abbrev.Pool1.next_i 'Note.Abbrev.start_i :=
	duplicate$ str.rawlen 'Note.Abbrev.len :=
	Meta.Abbrev.Pool1.next_i Note.Abbrev.len +
		'Meta.Abbrev.Pool1.next_i :=
	Meta.Abbrev.Pool1 swap$ * 'Meta.Abbrev.Pool1 :=
}

FUNCTION { Series.Abbrev }{
	Meta.Abbrev.Pool1 Series.Abbrev.start_i Series.Abbrev.len substring$
}
FUNCTION { Series.Abbrev.store }{
	Meta.Abbrev.Pool1.next_i 'Series.Abbrev.start_i :=
	duplicate$ str.rawlen 'Series.Abbrev.len :=
	Meta.Abbrev.Pool1.next_i Series.Abbrev.len +
		'Meta.Abbrev.Pool1.next_i :=
	Meta.Abbrev.Pool1 swap$ * 'Meta.Abbrev.Pool1 :=
}

FUNCTION { Title.Abbrev }{
	Meta.Abbrev.Pool1 Title.Abbrev.start_i Title.Abbrev.len substring$
}
FUNCTION { Title.Abbrev.store }{
	Meta.Abbrev.Pool1.next_i 'Title.Abbrev.start_i :=
	duplicate$ str.rawlen 'Title.Abbrev.len :=
	Meta.Abbrev.Pool1.next_i Title.Abbrev.len +
		'Meta.Abbrev.Pool1.next_i :=
	Meta.Abbrev.Pool1 swap$ * 'Meta.Abbrev.Pool1 :=
}

% 
% FILTERS, i.e. ".filtered" FUNCTIONS:
% 
FUNCTION {filtered.address}{
	address Address.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.author}{
	author Author.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.booktitle}{
	booktitle Booktitle.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.chapter}{
	chapter Chapter.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.editor}{
	editor Editor.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.howpublished}{
	howpublished HowPublished.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.institution}{
	institution Institution.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.journal}{
	journal Journal.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.month}{
	month Month.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.note}{
	note Note.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.organization}{
	organization Organization.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.publisher}{
	publisher Publisher.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.school}{
	school School.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.series}{
	series Series.Abbrev Abbrev.Delim abbreviate
}
FUNCTION {filtered.title}{
	title Title.Abbrev Abbrev.Delim abbreviate
}

FUNCTION {meta:author}		{ abbrev Author.Abbrev.store }
FUNCTION {meta:booktitle}	{ abbrev Booktitle.Abbrev.store }
FUNCTION {meta:chapter}		{ abbrev Chapter.Abbrev.store }
FUNCTION {meta:editor}		{ abbrev Editor.Abbrev.store }
FUNCTION {meta:howpublished}	{ abbrev HowPublished.Abbrev.store }
FUNCTION {meta:institution}	{ abbrev Institution.Abbrev.store }
FUNCTION {meta:journal}		{ abbrev Journal.Abbrev.store }
FUNCTION {meta:month}		{ abbrev Month.Abbrev.store }
FUNCTION {meta:note}		{ abbrev Note.Abbrev.store }
FUNCTION {meta:organization}	{ abbrev Organization.Abbrev.store }
FUNCTION {meta:publisher}	{ abbrev Publisher.Abbrev.store }
FUNCTION {meta:school}		{ abbrev School.Abbrev.store }
FUNCTION {meta:series}		{ abbrev Series.Abbrev.store }
FUNCTION {meta:title}		{ abbrev Title.Abbrev.store }

FUNCTION {meta.abbrev.init}
{
	#1 'Meta.Abbrev.Pool1.next_i :=
	#1 'Address.Abbrev.start_i :=		#0 'Address.Abbrev.len :=
	#1 'Author.Abbrev.start_i :=		#0 'Author.Abbrev.len :=
	#1 'Booktitle.Abbrev.start_i :=		#0 'Booktitle.Abbrev.len :=
	#1 'Chapter.Abbrev.start_i :=		#0 'Chapter.Abbrev.len :=
	#1 'Editor.Abbrev.start_i :=		#0 'Editor.Abbrev.len :=
	#1 'HowPublished.Abbrev.start_i :=	#0 'HowPublished.Abbrev.len :=
	#1 'Note.Abbrev.start_i :=		#0 'Note.Abbrev.len :=
	#1 'Series.Abbrev.start_i :=		#0 'Series.Abbrev.len :=
	#1 'Title.Abbrev.start_i :=		#0 'Title.Abbrev.len :=
}

FUNCTION {article}{
	"Article: " filtered.title * " by " * filtered.author * write$ newline$
}
FUNCTION {book}{
	"Book: " filtered.title * " by " * filtered.author * write$ newline$
}
FUNCTION {misc}{
	"Misc: " filtered.title * " by " * filtered.author * write$ newline$
}
FUNCTION {phdthesis}{
	"PhD Thesis " filtered.title * " by " * filtered.author * write$
		newline$
}
FUNCTION {default.type}{ misc }

MACRO {may}{"May"}

READ

FUNCTION { meta.collect_meta_info }
{
	type$ #1 #5 substring$ "meta:" =
	{ call.type$ }{}
	if$
}

% Initialize abbreviation collector:
EXECUTE {meta.abbrev.init}

% Collect meta configuration:
ITERATE {meta.collect_meta_info}

% Generate bibliography:
ITERATE {call.type$}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: abbrtest.ltx
Type: text/x-tex
Size: 171 bytes
Desc: not available
Url : http://tug.org/pipermail/texhax/attachments/20040729/b83a46c8/abbrtest.bin
-------------- next part --------------
@meta:title {,
	abbrev = "Bal#	->	#Cali#	->	#" #
		 "Br#	->	#Arch#	->	#"
}

@misc {Breschini:2003,
	author = "Breschini, Gary S.",
	title = "The {History of Archaeological Classification in Central
		California}",
	year = "2004",
	publisher = "Coyote Press",
	note = "Electronic document
		\url{http://www.californiaprehistory.com/reports01/rep0025.html}
		accessed " #may# " 3.\\
		Available as part of \citet{Breschini:1983}",
}

@phdthesis {Breschini:1983,
	author = "Breschini, Gary S.",
	title = "Models of Population Movements in Central California
		Prehistory",
	chapter = "2",
	year = "1983",
	school = "Washington State University",
}

@book {GerowEtAl:1968,
	author = "Gerow, Bert A. with Force, Rowland W.",
	title = "An Analysis of the University Village Complex With a
		Reappraisal of Central California Archaeology",
	publisher = "Stanford: Stanford University Press",
	year = "1968",
}


More information about the texhax mailing list