Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to read about .bst files from Tame the Beast. On page 39, there is this example for a multiplication function:

INTEGERS { a b }

FUNCTION {mult}
{
  ’a := %% we store the first value
  ’b := %% we store the second value

  b #0 < %% We remember the sign of b, and
    {#-1 #0 b - ’b :=} %% then consider its absolute value.
    {#1} %%
  if$
  ...

why are there b's that are not preceded by a '? Shouldn't all b's refer to the same b, the b that was declared inside INTEGERS, and should be preceded by a '?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

The syntax of BibTeX is such that

#1 'a :=

is an assignment, with the variable named a being set to the value 1, while

a #1 =

is a comparison, with the value of the variable a inserted and compared to 1.

BibTeX is a stack language, so more generally 'a leaves the name of the variable on the stack while just a leaves the value on the stack.

share|improve this answer
add comment

The line {#-1 #0 b - ’b :=} means: set the value of the variable whose name is 'b to the value of obtained by the operation where the value of one of the operand is b (the value currently stored by the variable 'b.

share|improve this answer
    
So b refers to the value of the variable whose name is 'b. Is that right? –  Mika H. Dec 4 '12 at 4:49
    
Yes, it is correct –  Guido Dec 4 '12 at 7:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.