[Tex/LaTex] Is it possible to italicize journal names and book titles through the .bst file

bibtexformattingitalicnatbib

I am working on an article for a Springer journal, and the specifications for manuscripts clearly ask to italicize all journal names and book titles. Doing it manually feels stupid, so I wonder if there's a way to make the BibTeX style do the trick for me. I am currently using spbasic.bst (natbib compatible stuff), and I have no experience in the obscure .bst language. Any hints?

Best Answer

As you say, the BibTeX stack language is a bit tricky. Here, we need to alter two functions. In a renamed copy of spbasic.bst, you first want to make journal names italic by altering FUNCTION {article}. It contains the lines

journal
remove.dots

which need so be altered to

journal
remove.dots
"\emph{" swap$ * "}" *

To alter book titles, changes are needed to FUNCTION {format.btitle}, which is short so I'll reproduce in full

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

In both cases, we are working with a stack containing 'the thing to be made italic'. First, I've added \emph{ to the stack, then used swap$ to put the thing after \emph{ on the stack. The * concatenates the two, then I add } to the stack and concatenate again.