2

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,

  • 1
    How does such an index look like? – user31729 Oct 8 '15 at 13:01
  • For cross references, Insert --> Cross-reference. Edit: You will probably need to add labels with Insert --> Label for the things you want to refer to. For figures/tables, place it inside the float box, after the caption. For e.g. sections, place it right after the section heading. – Torbjørn T. Oct 10 '15 at 16:47
1

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.

| improve this answer | |
  • As I understand it, a .lyx file is plain text. If that's so, you should be able to create the first option using a little gawk, sed etc. Either solution should work with extracting the references using external tools of this kind and transforming the extracted data into a suitable thing (LyX/fish option) or .bib (sane/fishing option). – cfr Oct 9 '15 at 1:13
  • @cfr I agree, but due to the LyX format I would try first the exported LaTeX source that is more friendly for my eyes. If a script with linux tools is not a option, then the search & replace and copy & paste of the LyX editor could extract all the references to the end of the document, and then go with plan A in case of emergency only. Otherwise, copy & paste the references to a plain text file to start definitively with the right foot = plan B. – Fran Oct 9 '15 at 6:47

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.