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.

Looking through few bst files (BibTeX styles) I noted that skip$ built-in function is sometimes referred to as 'skip$ (i.e. by name) and sometimes as skip$ (i.e. by value). I think I understand the construct such as

"string value" 'foo :=

which means that the function foo gets the value "string value" but I don't understand what is the difference between 'skip$ and skip$? Can one explain that issue. And how 'pop$ does differ from pop$?

For example plainnat.bst from natbib package has the following chunck of code:

FUNCTION {output}
{ duplicate$ empty$
    'pop$
    'output.nonnull
  if$
}

FUNCTION {output.check}
{ 't :=
  duplicate$ empty$
    { pop$ "empty " t * " in " * cite$ * warning$ }
    'output.nonnull
  if$
}

Second pair of examples is borrowed from aipauth4-1.bst (revtex package):

FUNCTION {date.block}
{
  new.block.comma
  skip$
}

but

FUNCTION {field.or.null}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}
share|improve this question

1 Answer 1

up vote 5 down vote accepted

I can explain what you need to do: the reasoning is something different!

You need to keep an eye on the braces here. For example

FUNCTION {output}
{ duplicate$ empty$
    'pop$
    'output.nonnull
  if$
}

could also be written as

FUNCTION {output}
{ duplicate$ empty$
    { pop$ }
    { output.nonnull }
  if$
}

The key thing to notice here is the if$ statement. That requires that it preceded by an integer and two 'functions'. If you use something like

FUNCTION {output}
{ duplicate$ empty$
    pop$
    output.nonnull
  if$
}

BibTeX will try to execute the functions incorrectly, and errors will come up. So for the two branches of a conditional, you need either

  • The branch in braces or
  • A single non-braced statement quoted as it's name using '.
share|improve this answer

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.