[Tex/LaTex] Indices and References in Lyx

bibtexcross-referencingindexinglyx

I am currently writing my thesis in LyX and I have a lot of references to use. Since I have no idea how BibTex works and to save time, I put my references as Index entry. However, this will not be later accepted by the correcting committee as they need reference pages and not indices. I cannot change them one by one manually because I have a looot of references, how can I automatically change them from indices to references.

And how can I make some cross references in the text.

Thank you,

Best Answer

What starts out on the wrong foot, ends on the wrong foot.

Take your time to understand the LaTeX / BibTeX / biblatex & biber options to have references and citations in a proper form.

You not explain if you have complete references inside each \index{} (the Idx⬜ in LyX) only the author-year cites, or both,, some like (in the source LaTeX) ...

Leslie Lamport, 1994 \index{Leslie Lamport, 
\emph{\LaTeX: A Document Preparation System}. 
Addison Wesley, Massachusetts, 2nd Edition, 1994.}

Anyway, you must convert the \index{whatever} in a \cite{key} in the final LaTeX source and put the complete reference somewere. There are only two practical solutions for this with LyX:

A) Using only a LyX file ("bread for today and hunger for tomorrow")

At the end of the document, make a bibliography environment (left format menu > select "Bibliography"). This will write:

References

key-1[]

Then put the cursor at the right of key-1[], press Enter to make as many entries as you want (key-2[],key-3[], etc.).

Copy the first complete reference (from the Idx⬜ in the example) and paste it after key-1[]. Next, click in this gray box to insert a unique identification key as lamport94 and the label as Lamport, 1994. The result should be a lamport94[Lamport, 1994] box before the reference.

Then return to the Idx⬜ and replace this box in by a citation box Insert > Citation... > Select lamport94 > Apply. A [lamport94] grey box should appear in the text. Make a PDF preview to check that this result will be a "[Lamport, 1994]" in the PDF text and and preceding the reference. Then make the same with the remaining references.

B) Using Lyx and a .bib file (strongly recommend this)

Copy the citations followed by their reference to an external text file with a blank line between references: To construct a .bib file could be a pain, but with a good text editor powered with macros, or if you are expert with Linux tools as sed, rpl, awk, ..., this could be less painful that do you think.

There are tools as makebib.perl to convert plain text references to BibTeX fomat, but if you do not what the automatic result, the idea is transform the citation as Leslie Lamport, 1994 in a key as lamport94 and split the reference so that the key and each part of the reference (authors, title, journal...) ends in separate line with a ending comma.

lamport94,
Leslie Lamport,  
LaTeX: A Document Preparation System, 
Addison Wesley,
Massachusetts, 
2nd Edition, 
1994, 

Next step is add the BibTeX code that identify the begin-end of each reference and comma separate fields, so that the final result must be some like:

@book{lamport94,
author={Leslie Lamport},  
title={LaTeX: A Document Preparation System}, 
editor={Addison Wesley},
address={Massachusetts}, 
edition={2}, 
year={1994}} 

The next step is open this .bib file with a good BibTeX editor as JabRef to check that the format is correct, and make the final changes.

Now return to LyX, go to the end of document > Insert > List/TOC ... > BibTeX bibliography > Add... > Browse... > select yourfile.bib > Add > OK. This insert the BibTeX Generated Bibliography box that in LaTeX source will be:

\bibliographystyle{plain}
\bibliography{yourfile}

Now you are ready to insert citations as above Insert > Citation... > Select lamport94 > ...

The big advantage of this "plan B" is that you can change easily and consistently the plain style without editing your references. On the other hand, you can manage/maintain/reuse/update easily huge amounts of references with specialized reference managers as Jabref.