4

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 enter image description here

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}

enter image description here

To produce the exact JAP reference appearance. We can just done a few text substitutions like:

  1. delete \em
  2. delete (5) and (7286)
  3. replace ":" as ","
  4. add round brackets to the year.
  5. bold 101 and 464
  6. 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.

  • A few things: (1) I don't think that the .bbl file is not really meant to be human-readable: it is an intermediate stage used to get to the final output; (2) the .bst controls the production of the .bbl; if you are using a particular .bst supplied by the journal, it doesn't matter how convuluted the .bbl file is: that's what the journal requires and expects. (3) although your style seems to be fairly uncomplicated, most others aren't: so there it is very important that each little field of an entry can be manipulated properly via macros like \citenamefont and so forth. – jon Sep 28 '14 at 16:28
  • @jon You are right. I have made great modification to my original questions, could you give any suggestions? – user15964 Sep 29 '14 at 5:58
4

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

  1. use makebst tool in package custom-bib
  2. use java based software bib-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 of bib-it). It has a Bibtex style generator, which is graphical. Now I will show how to use bib-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 titled Bibtex style generator. What you have to do is a 3 steps setting shown in the following picture:

  1. article enter image description here
  2. book enter image description here
    1. author enter image description here

Finally, you just press "generate and save", you got your custom bst file.

The appearance of the generated reference is like enter image description here

and the .bbl file generated automatically is quite clear

\begin{thebibliography}{}

\bibitem{10.1103/PhysRevLett.101.057003}
I.~I. Mazin, D.~J. Singh, M.~D. Johannes and M.~H. Du, {Phys. Rev. Lett.}
  \textbf{{101}}, 057003 (2008).

\bibitem{10.1038/nature08914}
I.~I. Mazin, {Nature} \textbf{{464}}, 183--186 (2010).

\end{thebibliography}

The only fault is the "pages", JAP only need start page. This can be fixed with a single substitution operation using regular expression.

0

You could insert the contents of your bib file at the start of your preamble (following the \documentclass line) using the filecontents environment.

\usepackage{filecontents} 
\begin{filecontents} {mwe.bib}
@online{tab:test,
  author                   = {Doe, John},
  Url                      = {http://www.example.com/images/image.jpg},
  Urldate                  = {2014-02-25},
  Timestamp                = {2014.06.13},
  Note                     = {Table \ref{tab1}}, %<== this should point to your table caption label
  year                     = {2014}, %this is necessary for the in-text citation to work
}
\end{filecontents}
  • Thank you, but I can't make it work, could you explain it further? – user15964 Sep 28 '14 at 15:47
  • @user15964 -- penguinpreferred is suggesting you embed your bibliography file in a filecontents environment (here with the name mwe.bib, so you'd need something like \bibliography{mwe}). Then you run latex, which will behave normally plus create the file mwe.bib; then you run bibtex and latex twice more and it will use mwe.bib to populate your bibliography. I suppose the idea is that you don't need to embed the .bbl this way. But whether the journal will let you do this is another question. – jon Sep 28 '14 at 16:32
  • 2
    The solution provided by @penguinpreferred avoids having to send more than a single file. But I'm not sure if that's what the user asked. If I'm not wrong, putting the content of the *.bbl file into the main avoids having to run bibtex, thus not having to check the *.bib file at all. Giving the *.bib file requires aditional compilation that the journal may not do. – U.Martinez-Corral Sep 28 '14 at 16:37
  • @jon OK, I understand what you mean. Thank you very much. But I still want to embed the references as a list of bibitems. You can see I modified my question, maybe you have other suggestions. – user15964 Sep 29 '14 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.