0

Is it possible to make the same change as in Bibtex - Make Title italic, Rest Upright for elsearticle-harv.bst?

I've made the changes in the .bst file, used the TDS tree.

It worked for alpha.bst, it just won't work for elsarticle-harv.

Here are the changes I made:

FUNCTION {format.title}
{ title empty$
    { "" }
    { title emphasize "t" change.case$ }
  if$
}

FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  format.date "year" output.check
  date.block
  format.title "title" output.check
  new.sentence
  crossref missing$
{ journal "journal" output.check
format.date "year" output.check
before.all 'output.state :=
format.vol.num.pages output
}

{ format.article.crossref output.nonnull
  format.pages output
}
  if$
  format.journal.pages
  format.note output
  fin.entry
  write.url
}

I could really use some help on this matter.

1 Answers1

1
  1. Copy elsarticle-harv.bst to the directory where your document is and rename it to elsarticle-harv-alt.bst. Do not edit the original file directly because an update could overwrite it.

  2. Edit elsarticle-harv-alt.bst.

    Change format.title, similar to what your showed in your question

    FUNCTION {format.title}
    { title empty$
        { "" }
        { title emphtitle "t" change.case$
        }
      if$
    }
    

    Add the function emphtitle (I added it above emphasize).

    FUNCTION {emphtitle}
    { duplicate$ empty$
        { pop$ "" }
        { "{\em " swap$ * "}" * }
      if$
    }
    

    If you are lazy, get the edited file directly from GitHub Gist.

  3. Use the new bibliography style.

    \begin{filecontents}{\jobname.bib}
    @article{srt,
      title={Zur Elektrodynamik bewegter K{\"o}rper},
      author={Einstein, Albert},
      journal={Annalen der Physik},
      volume={322},
      number={10},
      pages={891--921},
      year={1905},
      publisher={Wiley Online Library}
    }
    \end{filecontents}
    
    \documentclass{elsarticle}
    \begin{document}
    
    \nocite{*}
    
    \bibliographystyle{elsarticle-harv-alt}
    \bibliography{\jobname}
    
    \end{document}
    
  4. ???

  5. Profit

    enter image description here

Henri Menke
  • 109,596