# Author's initials in longbibliography for revtex4-1 aps style

I'm using the aps option for a revtex4-1 documentclass, and I'd like the bibliography to print the article titles. However, the longbibliography option also writes out the author's full names, as opposed to using first initials. Is there a way to get both initialed author names as well as article titles in the bibliography using this documentclass?

Here's a MWE:

\begin{filecontents}{testbiblio.bib}
@ARTICLE{one,
author = {John Smith},
title = {Recent advances in physics},
journal = {Phys. Rev. D},
year = {2015},
volume = {10},
pages = {123456},
number = {5}
}
\end{filecontents}

\documentclass[aps,prd,twocolumn,longbibliography]{revtex4-1}

\begin{document}

\cite{one}

\bibliography{testbiblio}

\end{document}


This gives me the article title but not the author name as "J. Smith". Is there some way to modify this to make that work, ideally using the revtex bibliography style, which handles hyperlinks and eprint references nicely?

For this, the desired output would be something like

1. J. Smith, "Recent advances in physics," Phys. Rev. D 10, 123456 (2015).

I'm also wondering if there is a way to do this without modifying the revtex bst file. For example, in the answer here, they say you can change the filenameNotes.bib file to set the bibliography options. But it seems like every time I run latex on the file, it resets the values of things living in the filenameNotes.bib file.

• Could you provide an exact example of the output you would like? You're saying you want "Recent advances in physics" to be replaced by "J. Smith, Recent advances in physics"? Apr 8 '15 at 7:46
• @Texman I added an example of what I'd like the entry to look like. Apr 8 '15 at 9:15
• In that case, you would simply edit the FUNCTION {format.names} in the same file. Apr 8 '15 at 10:17
• @asperanz Please mark one of answer as correct / accepted answer. It will be useful for others Apr 14 '15 at 12:58

Using the 'aps' option for a revtex4-1 documentclass, the following solution allows to keep all other particularities of the aps bibliographic style unchanged. Notably, it is possible to use a modified version of apsrev4-1.bst but this will probably affect the other behaviours. Here we will simply overwrite the parameters passed to apsrev4-1.bst style file.

Originally, the output of the RevTex package without 'longbibliography' will be

Now when you add the 'longbibliography' option you get this

with the awful mix of initials and full first names.

Actually the parameters for building the bibliography are stored in an extension of the .bib file called [Your file]Notes.bib of your document folder. To overwrite its output, add into your preamble, after the calls to packages,

\AtBeginDocument{%
\newwrite\bibnotes
\def\bibnotesext{Notes.bib}
\immediate\openout\bibnotes=\jobname\bibnotesext
\immediate\write\bibnotes{@CONTROL{REVTEX41Control}}
\immediate\write\bibnotes{@CONTROL{%
apsrev41Control,author="08",editor="1",pages="1",title="0",year="1"}}
\if@filesw
\immediate\write\@auxout{\string\citation{apsrev41Control}}%
\fi
}%


This will replace the text generated at the time of building the file. You can set manually all parameters in these lines of code. Here author="08" stands for "initials for authors". The integer value used for authors is actually encoded in a sum of powers of two, each one corresponding to a different parameter. title="0" allows the production of the article titles. Your output now looks like this

Note that the use of 'longbibliography' option is now ineffective but replaced by the manual values.

Beyond just initials, here is the list of all authors parameters as found in apsrev4-1.bst

  'control.author.jnrlst   swap$duplicate$ #64 control.decode
'control.author.dotless  swap$duplicate$ #32 control.decode
'control.author.nospace  swap$duplicate$ #16 control.decode
'control.author.initials swap$duplicate$  #8 control.decode
'control.author.nocomma  swap$duplicate$  #4 control.decode
'control.author.first    swap$duplicate$  #2 control.decode
'control.author.reversed swap$duplicate$  #1 control.decode


so for example use 16+8+1=25 to reverse order without spaces and use of initials. You need to set editor="0" to allow full control over author format. The parameter entered for author="HH" is actually an hexdecimal value. This means that for the previous example you have to set author="19"

• This is very clever Jan 28 '19 at 5:53

The simple solution is to modify the title field in the bib file. Change "Recent advances in physics" to "J. Smith, Recent advances in physics", and so on for each citation.

If you want a fix for the general case, you'll need to modify revtex4's .bst file to change the formatting of the output. On my system, Debian Linux with Tex Live, the location of the file is /usr/local/texlive/2014/texmf-dist/bibtex/bst/revtex4/apsrev.bst. The original format.title function is:

FUNCTION {format.title}
{ title
duplicate$empty$ 'skip${ "t" change.case$ } if$duplicate$ "title" bibinfo.check swap$duplicate$ empty$'pop$
{
punctuation.yes 'punctuation.state :=
string.enquote
select.language
}
if$}  Modify it to be: FUNCTION {format.title} { author #1 "{f. }{ll}" format.name$ ", " * title *
%duplicate$empty$ 'skip${ "t" change.case$ } if$duplicate$ "title" bibinfo.check swap$duplicate$ empty$'pop$
{
punctuation.yes 'punctuation.state :=
string.enquote
select.language
}
if$}  You can play with the format string for format.string$ to handle all your author names as you like. For a great reference on editing .bst files, see Tame the BeaST. I'm sure there's also a more elegant way to deal with the capitalization of the last name than clobbering the 2nd line, but this should be sufficient for now.

Edit: Here's a related approach applicable to the formatting you updated with: Only author's initials in BibTeX natbib using named style

• Good answer. Another great reference is at bibtexml.sourceforge.net/btxdoc.pdf, BibTeXing by Oren Patashnik (dated FEB 1988). Apr 8 '15 at 12:30
• This is useful if the document is only to be compiled on one system. For documents that have to be compiled on multiple machines (and multiple users) this is less useful. Mar 23 '16 at 13:17

\bibliographystyle{abbrv}


before

\bibliography{testbiblio}


full code. I modified little bit. :)

\begin{filecontents}{testbiblio.bib}
@ARTICLE{one,
author = {John Smith},
title = {Recent advances in physics},
journal = {Phys. Rev. D},
year = {2015},
volume = {10},
pages = {123456},
number = {5}
}
\end{filecontents}

\documentclass[aps,prd,twocolumn,longbibliography]{revtex4-1}

\begin{document}
vxdvsdsdf\cite{one}
sdfsdf
sdfs
df
sdf

\bibliographystyle{abbrv}

\bibliography{testbiblio}

\end{document}


Result

• This doesn't work with arxiv references, etc. It really just overwrites the longbilbiography option, and changes the formatting. It will work for this particular case, but is not the same. Jul 25 '18 at 22:15
• This has side effects: it changes the way the journal appreciations are displayed (italic) Jan 28 '19 at 5:52

I'll give the best trick I've come up with to make this work. First, I get rid of the longbibliography option in the documentclass command. Then I run latex on the file. It generates a file called filenameNotes.bib, with "filename.tex" the name of the tex file. This file contains the following,

@CONTROL{REVTEX41Control}
@CONTROL{apsrev41Control,author="08",editor="1",pages="0",title="",year="1"}


These seem to control the various style options for the bibliography style for revtex. Now I edit this file to look like

@CONTROL{REVTEX41Control}
@CONTROL{apsrev41Control,author="08",editor="1",pages="1",title="0",year="0"}


This seems to basically use the regular options for the formatting of the author's name, but tells it to also include the full article titles as well. Then I run bibtex on my file, and when I latex it, I get the desired author's initials, as well as the article titles.

I feel like this is a bit hacky, especially since I have to edit the filenameNotes.bib file every time I need to run bibtex (when I run latex, it restores this file to the original form). So this seems to be the nicest way I've seen to do this, but it would be nice to have a way that doesn't involve editing this file every time I re-compile the document.

• Editing the .bst provieds a generalized fix. If you don't want that much power, Tambe's suggestion to use \bibliographystyle{abbrv} might be enough. Apr 9 '15 at 16:57

I came out with other solution. One can directly modify \@bibdataout@aps. Just add in document preamble the following code (assuming longbibliography option in your documentclass):

\makeatletter
\def\@bibdataout@aps{%
\immediate\write\@bibdataout{%
@CONTROL{%
apsrev41Control%
\longbibliography@sw{%
,author="08",editor="1",pages="1",title="0",year="1"%
}{%
,author="08",editor="1",pages="1",title="",year="1"%
}%
}%
}%
\if@filesw \immediate \write \@auxout {\string \citation {apsrev41Control}}\fi
}
\makeatother