I am going to submit an article to Journal Of Applied Physics(JAP). So I'm using using revtex4-1 document class \documentclass[aip,jap,reprint,superscriptaddress,amsmath,amssymb]{revtex4-1}
.
During the preparation of my paper, I use .bib file to generate my reference list. But now reach the submitting time, I want to embedded reference into my latex file as \bibitems. One method is to copy the content of .bbl file which is automatically generated by .bib file during latex processing.
Just as Jon commented, the content of .bbl file is controlled by documentclass. But the problem is that I found the .bbl file generated by JAP documentclass style is so complex , lengthy and unreadable. Something like:
\begin{thebibliography}{2}%
\makeatletter
\providecommand \@ifxundefined [1]{%
\@ifx{#1\undefined}
}%
\providecommand \@ifnum [1]{%
\ifnum #1\expandafter \@firstoftwo
\else \expandafter \@secondoftwo
\fi
}%
\providecommand \@ifx [1]{%
\ifx #1\expandafter \@firstoftwo
\else \expandafter \@secondoftwo
\fi
}%
\providecommand \natexlab [1]{#1}%
\providecommand \enquote [1]{``#1''}%
\providecommand \bibnamefont [1]{#1}%
\providecommand \bibfnamefont [1]{#1}%
\providecommand \citenamefont [1]{#1}%
\providecommand \href@noop [0]{\@secondoftwo}%
\providecommand \href [0]{\begingroup \@sanitize@url \@href}%
\providecommand \@href[1]{\@@startlink{#1}\@@href}%
\providecommand \@@href[1]{\endgroup#1\@@endlink}%
\providecommand \@sanitize@url [0]{\catcode `\\12\catcode `\$12\catcode
`\&12\catcode `\#12\catcode `\^12\catcode `\_12\catcode `\%12\relax}%
\providecommand \@@startlink[1]{}%
\providecommand \@@endlink[0]{}%
\providecommand \url [0]{\begingroup\@sanitize@url \@url }%
\providecommand \@url [1]{\endgroup\@href {#1}{\urlprefix }}%
\providecommand \urlprefix [0]{URL }%
\providecommand \Eprint [0]{\href }%
\providecommand \doibase [0]{http://dx.doi.org/}%
\providecommand \selectlanguage [0]{\@gobble}%
\providecommand \bibinfo [0]{\@secondoftwo}%
\providecommand \bibfield [0]{\@secondoftwo}%
\providecommand \translation [1]{[#1]}%
\providecommand \BibitemOpen [0]{}%
\providecommand \bibitemStop [0]{}%
\providecommand \bibitemNoStop [0]{.\EOS\space}%
\providecommand \EOS [0]{\spacefactor3000\relax}%
\providecommand \BibitemShut [1]{\csname bibitem#1\endcsname}%
\let\auto@bib@innerbib\@empty
%</preamble>
\bibitem [{\citenamefont {Mazin}\ \emph {et~al.}(2008)\citenamefont {Mazin},
\citenamefont {Singh}, \citenamefont {Johannes},\ and\ \citenamefont
{Du}}]{10.1103/PhysRevLett.101.057003}%
\BibitemOpen
\bibfield {author} {\bibinfo {author} {\bibfnamefont {I.~I.}\ \bibnamefont
{Mazin}}, \bibinfo {author} {\bibfnamefont {D.~J.}\ \bibnamefont {Singh}},
\bibinfo {author} {\bibfnamefont {M.~D.}\ \bibnamefont {Johannes}}, \ and\
\bibinfo {author} {\bibfnamefont {M.~H.}\ \bibnamefont {Du}},\ }\href
{\doibase 10.1103/PhysRevLett.101.057003} {\bibfield {journal} {\bibinfo
{journal} {{Phys. Rev. Lett.}}\ }\textbf {\bibinfo {volume} {{101}}},\
\bibinfo {pages} {057003} (\bibinfo {year} {2008})}\BibitemShut {NoStop}%
\bibitem [{\citenamefont {Mazin}(2010)}]{10.1038/nature08914}%
\BibitemOpen
\bibfield {author} {\bibinfo {author} {\bibfnamefont {I.~I.}\ \bibnamefont
{Mazin}},\ }\href {\doibase 10.1038/nature08914} {\bibfield {journal}
{\bibinfo {journal} {{Nature}}\ }\textbf {\bibinfo {volume} {{464}}},\
\bibinfo {pages} {183} (\bibinfo {year} {2010})}\BibitemShut {NoStop}%
\end{thebibliography}%
the appearance of reference is like this
Well, pasting such a huge block of data into latex file surely works. But it's unreadable.
Actually, if we use modified unsrt
style mentioned here Is it possible to get unsrt + abbrv bibliography?. We can generate reference appearance quite similar to JAP style. The modification in done in unsrt.bst
file. Since author name in the original unsrt
is not JAP style. So by changing ff~
into f.~ in FUNCTION {format.names}
, we got JAP author name style. The generated .bbl file is much clear now as below:
\begin{thebibliography}{1}
\bibitem{10.1103/PhysRevLett.101.057003}
I.~I. Mazin, D.~J. Singh, M.~D. Johannes, and M.~H. Du.
\newblock {\em {Phys. Rev. Lett.}}, {101}(5):057003, 2008.
\bibitem{10.1038/nature08914}
I.~I. Mazin.
\newblock {\em {Nature}}, {464}(7286):183--186, 2010.
\end{thebibliography}
To produce the exact JAP reference appearance. We can just done a few text substitutions like:
- delete \em
- delete (5) and (7286)
- replace ":" as ","
- add round brackets to the year.
- bold 101 and 464
- change 183–186 into 183
the above list of operations can be done easily with some regular expression substition knowledge. And finally we got the following \bibitems that produce exactly the same JAP reference style.
\begin{thebibliography}{1}
\bibitem{10.1103/PhysRevLett.101.057003}
I.~I. Mazin, D.~J. Singh, M.~D. Johannes, and M.~H. Du.
\newblock {{Phys. Rev. Lett.}} \textbf{101}, 057003 (2008).
\bibitem{10.1038/nature08914}
I.~I. Mazin.
\newblock {{Nature}} \textbf{464}, 183 (2010).
\end{thebibliography}
Just like changing ff~
to f.~
in unsrt.bst
gives the right JAP style author name. I believe that we just need a few more modification to the unsrt.bst
file to generate the right and clear \bibitems in JAP style in a single step, so I needn't any regex subsititution postprocessing.
Best Answer
I think maybe I can answer my own question now.
The key to this problem is to generate a custom bibliography style bst file.
There are two ways to do it
makebst
is a command-line tool to generate a custom .bst file after you answering a series of around 70 questions related to the format of the reference style you want. For me it is not so friendly, you can learn how to use it step by step by reading this article LaTeX, bibliography management and styles.On the other hand, I found to use
bib-it
is much easier (Thanks to the author ofbib-it
). It has aBibtex style generator
, which is graphical. Now I will show how to usebib-it
to generate a JAP style .bst file in just a few minutes.Opening
bib-it
, click "tools-->style generator". you will see an graphical interface titledBibtex style generator
. What you have to do is a 3 steps setting shown in the following picture:Finally, you just press "generate and save", you got your custom bst file.
The appearance of the generated reference is like
and the .bbl file generated automatically is quite clear
The only fault is the "pages", JAP only need start page. This can be fixed with a single substitution operation using regular expression.