3

I am trying to adapt the BibTeX style file supplied with the LNI LaTeX template to actually match the style defined in the guidelines from the same page (sorry, as opposed to the guidelines document, the page with the links is only available in German). I had never looked into the BST language before and thus was happy to easily being able to modify the number of displayed names and the format of names, but the separator after the list of authors is still an open issue:

The style file insists on adding a fullstop by using the add.period command after each segment of a bibliography item. The guidelines, however, require that a colon be added after the author names.

I have tentatively inserted a colon in the various template functions, which are generally structured like this:

format.authors "author" output.check
new.block
format.title "title" output.check

new.block and output.check being generic functions defined in the same BST file. Somewhere in there, add.period is invoked.

Unfortunately, if I add a colon either before or after new.block, another period is added after the colon, making the references look like this:

Sample, S.; Example, E.:. An Example Paper For Your Bibliography.

Apparently, add.period ignores colons (well, the documentation implicitly states just that). Therefore, my idea was wrapping the add.period function (which is called only three times in the BST file, so replacing all calls with calls to the wrapper function should be feasible) that checks whether the last character is a colon, and if so, nothing is done, otherwise add.period is invoked.

This is my wrapper function:

FUNCTION {safe.add.period}
{ 's :=
  s s text.length$
  #1 substring$
  ":" =
    'skip$
    { s add.period$ 's := }
  if$
  s
}

It should work like this:

  • take the topmost string from the stack and store it as s
  • put that string and its length onto the stack
  • replace those two with the last character of the string
  • compare that character with a colon
  • if the comparison returned true, do nothing, else invoke add.period on s and assign the result back to s
  • put s back onto the stack, as the pure add.period would

I have replaced all three invocations of add.period with safe.add.period, however all periods are missing now. It seems like add.period never gets called. What am I doing incorrectly?

closed as unclear what you're asking by Joseph Wright Apr 11 '15 at 21:20

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Did they asked you to adapt their bst to the guidelines? – Ulrike Fischer Apr 30 '14 at 16:27
  • 1
    @UlrikeFischer: No. I am simply trying to follow the submission guidelines as required by the conference I am preparing a paper for. So, as the BST file does not match the guidelines, I have to modify it so as to adhere to the guidelines. Not to mention that most of the changes made the references considerably shorter, and as so often, every extra available line is a gain. Of course, correctly placing that colon will not save any further space, but on the one hand, I dislike sloppy work, and on the other hand, I'm simply intrigued by the problem and interested in learning how to solve it. – O. R. Mapper Apr 30 '14 at 17:42
  • I wouldn't spent time to learn how to adapt bst-files. That's an dying art. If you simply need an implementation of the style: do it with biblatex/biber. – Ulrike Fischer Apr 30 '14 at 17:46
  • @UlrikeFischer: Hmm, I see. In that case, I might consider skipping that bit about the colon (which doesn't mean I'm not still interested in what I'm doing wrong) rather than introducing a new tool (and convincing my co-authors of it), with the submission deadline being only a few days ahead. Thanks for the pointer, I will read up on the Biblatex/Biber project. – O. R. Mapper Apr 30 '14 at 17:51
  • 1
    Well if you want find about the colon then you should set up a correct and complete example people can use for tests. Code snippets are not useful. – Ulrike Fischer Apr 30 '14 at 18:20

Browse other questions tagged or ask your own question.