BibTeX, biblatex and biberProblem with bst file (bibliography style)

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
Stergann
Posts: 1
Joined: Mon Aug 23, 2010 3:31 pm

Problem with bst file (bibliography style)

Post by Stergann »

Hi all,

in my bst file, i would like to remove the "." at the end of the entry title when it is present. I think that i must use the function substring$ but i do not know how to proceed. Could you help me please.

thanks by advance
regards
Stergann

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

olofos
Posts: 56
Joined: Tue Nov 24, 2009 10:37 pm

Problem with bst file (bibliography style)

Post by olofos »

Here is one solution:

Code: Select all

ENTRY {} {} {}
FUNCTION {remove.period.at.end} {
duplicate$
#-1 #1 substring$
"." =
{ duplicate$ text.length$ #1 - text.prefix$ }
'skip$
if$
}
READ
FUNCTION {test} {
"Abc." remove.period.at.end top$
"{Abc.}" remove.period.at.end top$
"Abcd" remove.period.at.end top$
}
EXECUTE {test}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This solution is a bit ugly since it mixes substring$, which treats each character in the string as is, with text.prefix$, which takes into consideration bibtex's special characters.

A nicer solution, which uses the string.length function from Tame the BeaST:

Code: Select all

ENTRY {} {} {}
FUNCTION {not}
{ { #0 }
{ #1 }
if$
}
INTEGERS{ l }
FUNCTION{ string.length } {
#1 'l :=
{duplicate$ duplicate$ #1 l substring$ = not}
{l #1 + 'l :=}
while$
pop$ l
}
FUNCTION {remove.period.at.end} {
duplicate$
#-1 #1 substring$
"." =
{ duplicate$ string.length #1 - #1 swap$ substring$ }
'skip$
if$
}
READ
FUNCTION {test} {
"Abc." remove.period.at.end top$
"{Abc.}" remove.period.at.end top$
"Abcd" remove.period.at.end top$
}
EXECUTE {test}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Here all characters are treated in the same way.

Note that these functions only removes a period if it is the very last character in the string (at brace depth zero). So a period protected by braces, as in the second example in the test function, will not be removed. I think doing that would be much harder.

Olof
Post Reply