LaTeX to BibTeX

Based on a quick google search, there are a couple of scripts that might work:

tex2bib: http://mirror.ctan.org/biblio/bibtex/utils/tex2bib

convertbiblio http://www.mi.infm.it/manini/scripts/convertbiblio.py

Usual caveats of course apply to running scripts from the internet! As others have indicated, you will likely have to clean your entries up manually. Scraping bibliographic data from formatted entries is not trivial, especially if you use a heavily customized style.

Credit to the TeX FAQ for linking to tex2bib.


I came up with a simple solution to this problem.

Unfortunately this solution works only for those who have references registered in the https://inspirehep.net/ website.

Here it goes:

First, I wrote a file with all my references (which I called bib.txt). Here is an example of what it contains:

%\cite{White:2012zza}
\bibitem{White:2012zza} 
  R.~M.~White [BaBar Collaboration],
  %``Recent charm physics results from BaBar,''
  J.\ Phys.\ Conf.\ Ser.\  {\bf 347}, 012026 (2012).
  %%CITATION = 00462,347,012026;%%


 %\cite{Zupanc:2013byn}
  \bibitem{Zupanc:2013byn} 
    A.~Zupanc {\it et al.}  [Belle Collaboration],
    %``Measurements of branching fractions of leptonic and hadronic $D_{s}^{+}$ meson decays and extraction of the $D_{s}^{+}$ meson decay constant,''
  JHEP {\bf 1309}, 139 (2013)
 [arXiv:1307.6240 [hep-ex]].
%%CITATION = ARXIV:1307.6240;%%
 %13 citations counted in INSPIRE as of 04 Nov 2014kda

Thus, I wrote a script (attached at the end of the answer) on mathematica that read the file and output it into a file "bibform.tex" in a specific format so that when you submit it to this website (https://inspirehep.net/submit?doctype=bibtex&act=SBI) it gives you the desired format for you reference style.

SetDirectory[NotebookDirectory[]];
file = OpenRead["bib.txt"];
x = ReadList[file, String];
Close[file];

file = OpenWrite["bibform.tex"];
WriteString[file, "\\documentclass[a4paper,12pt]{article}"];
WriteString[file, "\\begin{document}"];
j = 0;

Do[
If[StringMatchQ[x[[i]], "*" <> "\cite{" <> "*"],
WriteString[file, 
"a~\\cite{" <> 
 StringSplit[StringSplit[x[[i]], "}"][[1]], "{"][[2]] <> "}" <> 
 "\n\n"];
j = j + 1;
  ];
, {i, 1, Length[x]}]

WriteString[file, "\\end{document}"];
Print["Found " <> ToString[j] <> "  References.\n"]
Print["File Writen:"]
Close[file]
Print["Upload the file to: \

https://inspirehep.net/submit?doctype=bibtex&act=SBI\n to get the \
output format."]