7

There exist two major ways of defining a bibliography:

  1. Embedded

    Declare \begin{thebibliography} at the end of your file and use \bibitem . The entries look like

    \bibitem{amin1}
      S.~P. Beeby, M.~J. Tudor, and N.~White, ``Energy harvesting vibration sources
      for microsystems applications,'' {\em Measurement science and
      technology}~{\bf 17}(12), p.~R175, 2006.
    
  2. Using BibTeX- The entries are stored in a .bib file. The entries look like :-

     @article{amin1,
      title={Energy harvesting vibration sources for microsystems applications},
      author={Beeby, S Pꎬ and Tudor, M Jꎬ and White, NM},
      journal={Measurement science and technology},
      volume={17},
      number={12},
      pages={R175},
      year={2006},
      publisher={IOP Publishing}
    }
    

Is there an easy, automated way to convert entries from 2 to 1.

I have been using format 2, i.e using a bib file. But I want to switch to format 1 without manually changing all the entries. Is this possible?

7
  • 1
    going from 1 to 2 is exactly (and all) bibtex does, Jan 30, 2017 at 18:45
  • 2
    see for example the answer to another question today tex.stackexchange.com/questions/351230/… the input is a bib file like your (2) but running bibtex genrates a bbl file which is a bibliography environment like your (1). Jan 30, 2017 at 18:56
  • @DavidCarlisle, Thanks for answering. I have updated the question. I guess it was not very clear. Feb 3, 2017 at 1:06
  • @AdityaNanda: Converting from (2) to (1) is done via BibTeX, as already mentioned. Also, the process can be automated in most editors.
    – Werner
    Feb 3, 2017 at 1:27
  • @AdityaNanda it was clear, and the answer is the same, converting from (2) to (1_ is all bibtex can do Feb 3, 2017 at 7:46

1 Answer 1

4

The conversion from a BibTeX .bib file to an embedded thebibliography environment depends on the bibliography style you're after. The style defines the layout and formatting of specific @type references.

The suggestion would be to:

  1. Use BibTeX to compile your file under the specific style you're interested in. For example,

    \documentclass{article}
    
    \usepackage{filecontents}
    \begin{filecontents*}{references.bib}
    @article{greenwade93,
      author = {George D. Greenwade},
      title = {The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})},
      year = {1993},
      journal = {TUGBoat},
      volume = {14},
      number = {3},
      pages = {342--351}
    }
    \end{filecontents*}
    
    \begin{document}
    
    \nocite{*}
    
    \bibliographystyle{plain}
    \bibliography{references}
    
    \end{document}
    

    When compiled using LaTeX > BibTeX > LaTeX > LaTeX, the above minimal example (called filename.tex) creates filename.bbl:

    \begin{thebibliography}{1}
    
    \bibitem{greenwade93}
    George~D. Greenwade.
    \newblock The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN}).
    \newblock {\em TUGBoat}, 14(3):342--351, 1993.
    
    \end{thebibliography}
    

    BibTeX already took care of the formatting and layout, as well as the sort order (if that has been specified in some way, even using a different package).

  2. Exchange

    \bibliographystyle{plain}
    \bibliography{references}
    

    for

    \input{filename.bbl}
    

    in your code.

enter image description here

8
  • Also see Edifix (a small write-up about it).
    – Werner
    Jan 31, 2017 at 16:25
  • Thansks for the answer. I ran the minimal example in 1, did run well but it created a "references.bib" not 'filename.bib'. Further, I am looking for a method to transfer bib entries from one to another in an automated way. I have added new stuff in question details ~too long to put here. Feb 3, 2017 at 0:57
  • Any chance of something similar working with BibLaTeX? I tried to repeat the same strategy, but the .bll file does not contain things that the .tex file is likely to understand (instead of "bibitem" it has "entry" and the whole syntax looks completely different to me.
    – Brightsun
    Jun 28, 2019 at 14:06
  • @Brightsun: biblatex completely changes the syntax of how the bibliography functions. That's also why the .bbl also starts out checking whether you've loaded biblatex, otherwise it doesn't read any of the file contents. Since it does stem from a .bib which has a common syntax, it might be better to see if you can make your own bibliography style that matches what you've created with biber, only this time with BibTeX.
    – Werner
    Jun 28, 2019 at 15:42
  • OK @Werner, then I should probably master another package such as natbib or the one you employed in the example, if I plan to make these conversions often. In the end I managed with converting from the bll from natbib but I had to change manually a LOT of stuff...
    – Brightsun
    Jun 28, 2019 at 16:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .