Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Ok. I feel pretty stupid but I was trying to find a solution to using mathematics in bibliography. I ended up using the following example in this forum that used filecontents. Help with math symbols in BibTeX The following is what I used right before defining documentclass and database.bib was my main bibliography file in the same folder.

\RequirePackage{filecontents}        % loading package filecontents
% writing file \jobname.bib, for example mb-bibtex.bib.
\begin{filecontents*}{\database.bib}
@ARTICLE{UCH86,
AUTHOR =            {Uchida, I. and Nishina, T. and Mugikura, Y. and Itaya, K.},
TITLE =             {Gas electrode reactions in molten carbonate media. Part I. Exchange current density of oxygen reduction in $(Li+K)CO_3$ eutectic at $650^{\circ}$ C},
JOURNAL =       {J of Electroanal. Chem.},
VOLUME =            {206},
YEAR =              {1986},
PAGES =             {229--239}
}
\end{filecontents*}

Unfortunately, database.bib was my most updated bibliography file and it seems to me that putting the above filecontents section before my main .tex (as below) and executing my .tex file wiped out contents of my database.bib leaving just one entry. Is there any way to recover the wiped out file?

\documentclass[12pt]{report}
\usepackage{graphicx,xcolor}
\usepackage{footnote}
\makesavenoteenv{table}
\usepackage[abs]{overpic}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[centertags]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{newlfont}
\usepackage[version = 3]{mhchem}
\usepackage{rotating}
\usepackage{mathptmx}
\usepackage{textcomp}
\usepackage{booktabs}
\usepackage{nomentbl}
\usepackage{thesisdef}
\usepackage{xthesis} %DAL Thesis Style
\usepackage{xtocinc} %Include Table of Contents as the first entry in TOC
\usepackage{appendix}
\usepackage[numbers]{natbib}
\usepackage{array}
\newcolumntype{L}{>{\centering\arraybackslash}m{3cm}}
\newcolumntype{S}{>{\centering\arraybackslash}m{1.8cm}}
\makenomenclature
\begin{document}

stuff

\bibliographystyle{plainnat}
\bibliography{\database} %%% ... Good for using one single database...
\end{document}
share|improve this question
1  
Only ever backup data you mind losing. Restore from backup. See if there is an auto-saved version. (E.g. on unix-like systems, look for .database..., database.bib~. tmp, swp etc. are possible suffixes. This is editor/system/config dependent.) But if you did what you said, you overwrote the file in place. It is very unlikely you can get anything back unless you are prepared to pay for recovery and even then probably unlikely. (The new file is shorter so may not have overwritten all of the content. However, if you've been using the disk since, it is even less likely.) –  cfr Jul 16 at 3:09
1  
If this was only you most current version, just go back to the next most recent and redo whatever changes you made recently. That is likely to be by far more effective than anything else. –  cfr Jul 16 at 3:13
2  
Using the starred filecontents* version overwrites whenever the file already exists. –  Werner Jul 16 at 4:14
1  
Sorry for your loss… –  Clément Jul 16 at 9:15
1  
I spent last night trying to recoup my loss of about 25 citations, and it seems now I might be only a little behind. Of course, I had to re-enter about 20 of those. I still need to take care of few remaining. So, it wasn't that bad after all. Lesson Learnt - Don't be blind. Funny thing is I never got an inkling of what it was gonna do when I ran that filecontents. So perhaps, can somebody point me to a good method of using mathematics in bibliography. How do you maintain your original .bib file and just be able to write couple of citations that need mathematical treatment. Thanks –  ritesh Jul 16 at 14:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.