# removing a comma after a field in a bst file

Apropos to my earlier question on bst file editing (and using the same bst file described there), I tried to add a title to the bibliographic output with a period at the end. This apparently worked well but for a pesky comma that is appended after the period following the title. I cannot figure out where this comma is coming from or how to remove it. Perhaps it is a general delimiter added after each field. What would be the simplest way to remove it?

I appended a period to the end of the title by adding ". " * to format.title:

FUNCTION {format.title}
{ title empty${ "" } { title ". " * "t" change.case$
% title "t" change.case$% original line } if$
}


I then added a title to articles by adding the line format.title "title" output.check to FUNCTION {article}:

FUNCTION {article}
{ output.bibitem
format.authors "author" output.check
crossref missing${ format.title "title" output.check % added this line journal emphasize "journal" output.check add.blank format.vol.num.pages output format.date "year" output.check } { format.article.crossref output.nonnull format.pages output } if$
new.sentence
format.note output
fin.entry
}


The MWE is as before, but the output has changed (showing the undesired comma after the title).

\documentclass{article}
\usepackage{scicite}

\begin{document}

According to the theory of special relativity~\cite{einstein1905}, \ldots

\bibliography{a}
\bibliographystyle{Science}

\end{document}


Bib file (a.bib):

@article{einstein1905,
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}
}


The full bst file can be accessed here.

The scicite style file can be accessed here.

I would not modify the format.title macro to bring its own punctuation. Instead you can tell BibTeX to start a new sentence after the title with

FUNCTION {article}
{ output.bibitem
format.authors "author" output.check
crossref missing${ format.title "title" output.check new.sentence journal emphasize "journal" output.check add.blank format.vol.num.pages output format.date "year" output.check } { format.article.crossref output.nonnull format.pages output } if$
new.sentence
format.note output
fin.entry
}


Then

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{einstein1905,
title   = {{Zur Elektrodynamik bewegter K{\"o}rper}},
author  = {Einstein, Albert},
journal = {Annalen der Physik},
volume  = {322},
number  = {10},
pages   = {891--921},
year    = {1905},
}
\end{filecontents}

\begin{document}

According to the theory of special relativity~\cite{einstein1905}, \ldots

\bibliography{\jobname}
\bibliographystyle{Science-user001}
\end{document}


gives

Note the corrected capitalisation in the title and journal fields. Note also the double curly braces around the title field. They suppress the sentence casing function that would otherwise apply English sentence case rules to the German title (which would result in orthographically incorrect output). Usually I am strongly opposed to protecting the entire title field with double curly braces. I believe it is much better to protect only those words that need case protection separately from the sentence casing mechanism. See BibTeX loses capitals when creating .bbl file. But this is an exception to the rule I feel.

• The number of modifications you want to apply to Science.bst make me think that it might be cleaner to start from a different style altogether. The makebst offers has a way to produce customised bibliography style for you. And there are a lot of other ready-made styles available. – moewe Apr 4 at 15:18
• Thanks again for imparting your knowledge on this subject. I am most grateful. I did take advantage of the * from our previous discussion, but you have thoughtfully pointed out a better approach. I'm hoping that's the last modification I will require. Unfortunately, that style file is what the journal provides; evidently they receive very few latex submissions, and their style file has consequently not been updated to reflect the current bibliographic practices of the journal. – user001 Apr 4 at 15:20
• @user001 If it is their style I would stick with it for now. If you are worried the style does not produce the correct output I would urge you to contact the editor and inform them about the discrepancy between the expected and actual output. – moewe Apr 4 at 15:45