3

I am trying to set the book title style to plain in namedplus.bst but don't seem to be able to. Currently this is what I have

FUNCTION {format.btitle}
{ title emphasize
}

and replacing it with the following code from another style file that gives plain text format for the title gives me error messages

FUNCTION {format.btitle}
{ title "title" bibinfo.check
  duplicate$ empty$ 'skip$
    {
    }
  if$
}

error message: the literal stack isn't empty for entry

could you please help me with this?

2
  • Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}). Feb 5 '13 at 16:39
  • To understand what is going on, we would need to know what bibinfo.check does. But have you tried simply deleting the emphasize in the format.btitle function?
    – Corentin
    Feb 5 '13 at 16:52
1

Simply remove the emphasize:

FUNCTION {format.btitle}
{ title
}

The checks you copied are unnecessary, as the formatted title is checked in different places.

1

The function emphasize in the file namedplus.bst is defined as follows:

FUNCTION {emphasize}
{ duplicate$ empty$
    { pop$ "" }
    { "{\em " swap$ * "}" * }
  if$
}
  • I recommend you first create a function called, say, plain, to be placed right after the emphasize function, which mimics all aspects of the emphasize function except that it skips the \em directive:

    FUNCTION {plain}
    { duplicate$ empty$
        { pop$ "" }
        { "{" swap$ * "}" * }
      if$
    }
    

    Upon reflection, the line { "{" swap$ * "}" * } doesn't do anything at all, and hence the function plain may be simplified to:

    FUNCTION {plain}
    { duplicate$ empty$
        { pop$ "" }
        { }
      if$
    }
    
  • Second, replace the instruction title emphasize in the format.btitle function with

    title plain
    
  • Finally, be sure to save the file under a new name, e.g., mynamedplus.bst and to provide the instruction

    \bibliographystyle{mynamedplus}
    

    in your TeX document to start using the modified bibliography style.

5
  • Won't work. You replace the title with an empty string.
    – mafp
    Feb 5 '13 at 22:14
  • @mafp - Please see the corrected version.
    – Mico
    Feb 6 '13 at 1:06
  • 1
    OK, now it will work. But it is really pedantic. E.g., the braces you add around the title are superfluous. If you remove that, your plain function boils down to an empty$ check, and then the title is left on the stack. But then the empty$ check is superfluous, as the check was in emphasize to make sure there are strings to be concatenated, and the real check that can produce user warnings happens elsewhere. If you remove that check too, the function boils down to FUNCTION {plain}{}, which should not be in any bst file. The advice to make the changes transparent is good, though.
    – mafp
    Feb 6 '13 at 1:54
  • @mafp -- I guess I don't see the need to dispense with the both the duplicate$ and empty$ checks when executing the call to "print" the book's title.
    – Mico
    Feb 6 '13 at 15:51
  • When the title is actually printed via output.check or its variants, the check is fine, and will generate a visible warning$. But look what your plain function does now: if the literal on the stack is empty, it is popped, and a new empty string is put on the stack (Why?). If the literal is not empty, the function does nothing. Basically, your function does nothing than burning electricity ;-) That's why I said that your function is equivalent to FUNCTION {plain}{} under all circumstances.
    – mafp
    Feb 6 '13 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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