Lyx Tutorial Bibliography

Categories: Simple examples, Bibliography

<< | Page list | >>

Introduction to using BibTeX with LyX

Paul Johnson has created a simple introductory example of how to use BibTeX together with LyX (see the links at the end of this page). This is a simple explanation of the key terms and ideas, and other documentation in this site will certainly be helpful after these elementary ideas are understood. The original post in the user's list was his original mail Subject: Elementary BibTeX/Lyx introduction available When I started using LyX, I had never heard of BibTeX and was distressed that most documentation about bibliographies in LyX assumed I knew about LaTeX and BibTeX. After a while, I found a workable way and wrote up an introductory explanation for newcomers. The document that shows the results of the process while displaying the linkage between LyX and BibTeX has been uploaded here: That is simple and graphically illustrated. A package including the lyx file and the graphics and bibliography files for the example have also been uploaded.
uploads:/BibTeX/LyXBibTeXExample.tar.gz
A less well illustrated (more fumbling and bumbling) document was circulated a while ago, and I don't really recommend it to new users. The only unique component is that it explains one route by which to create customized natbib style files for particular journals. That other document is here http://www.ku.edu/~pauljohn/latex/LaTeX_Bibliographies.html and after people have made LyX work just once or twice with their BibTeX file, then it will be appropriate to tackle the questions of style customization. -- Paul E. Johnson

See also

An introduction to LyX, LaTeX and TeX which has a section on BibTeX with screenshots from LyX 2.0.

  • http://bradlug.co.uk/wp-content/uploads/2011/09/LyX_2_the-ultimate_document_software.pdf(approve sites)

Simple examples

Links

Bibliography

I am just in the process of finishing writing my PhD, which I wrote entirely in LyX. The productivity advantages of using LyX over LaTeX are too large to ignore, which is why I went with LyX, and why you should too. In this post I will go over the process I went through to get LyX producing documents conforming with my university’s thesis formatting guidelines.

If your anything like me, you have a mixture of past papers you have written in LaTeX, as well as a bunch of notes and drafts in LyX. The university provides a thesis template in LaTeX which the recommend you use. Fortunately, it is actually not too difficult to convert such a template into a working LyX document. Likewise, the papers in LaTeX can also be imported into LyX.

My LyX thesis template is available for download here: template-thesis.zip. The source code is also on github at https://github.com/adefazio/lyx-thesis-template.

Creating a preamble

We will get LyX to format our document correctly using the thesis style by overriding most things using a preamble file containing TeX commands. The advantage of this approach is we can pretty much copy and paste the LaTeX from the thesis template provided by the university.

I used two preamble files. The primary file contains the usual TeX package statements, includes and the like. It points to the ANU thesis style file as well:

This is not exactly the same as the preamble in the ANU provided style files. Several packages are already automatically imported by LyX, so they don’t need to be included here.

The default style uses the traditional American indenting of the first line of each paragraph. I think that looks old-fashioned, so I change it to just put a little but more padding between paragraphs instead:

The second file I use is main-preamble.tex, which contains the title and author information:

Setting up chapters as child documents

You probably want to setup your thesis so that each chapter is in a separate document. In LaTeX you would have each chapter imported into your main TeX file using \input{}. In LyX, this is done using child documents. As an example, the main document for my thesis looks like the following:

Setting up the main document

Create a new document, and go to Document->Settings->LaTeX Preamble, put in the preamble files we created above:

Each of the child documents is included via Insert->File->LyX Document ... The “include type” needs to be set to “include” for it to work correctly. The \mainmatter command signifies the switch over from page numbering using Roman numerals (for the introductory material) to Arabic numerals (for the thesis proper). It is inserted using the “TeX Code” insertion (Ctrl-L), which just directly inserts LaTeX commands into the document.

The Append is started with Document->Start Appendix Here, which should probably be in the insert menu of LyX instead. The bibliography is created with Insert->List/TOC->BibTex bibliography.., which lets you select a BibTex .bib file to use for your citations. LyX supports using multiple different bib files, which would appear useful if your combining multiple papers you have written into a thesis. A word of caution: if there are repeated entries between the bib files you will run into various hard to debug problems in LyX, especially if the entries only differ in capitalisation. I would suggest taking all the bib files and merging them using a command line tool into one file. I used the command:

LyX obeys most of the styling information specified by the preamble we created above. However, there are a few things that it overrides. Follow steps 3-7 from the next section to fix these up.

Setting up the child documents

In my case I put each child document in it’s own folder. This is not necessary, but it seemed like a good idea to keep the child documents in a folder together with any figures used by that document. I will walk through the creation of a single child document here. I created all the chapters initially by just copying the first one I created, but you could do it in a more organised way using LyX templates. The steps for creating the chapter are:

  1. Create a new empty LyX document and save it to a folder with the chapter within your thesis directory.
  2. Add the document to your main document using the include procedure described above.
  3. Open up the settings of the chapter document, and set the document class to Book, and in the master document field, point it at your main.lyx document
  4. On the font section, change the default family base font size to what ever your university requires. This was different than the default for me.
  5. Tick the Two-sided document check-box under Page Layout. This sets it so that the margin is wider on the outside-edge of each page, so it looks right when bound as a book.
  6. On the Language section, change it to English (Australian) or English (UK) if your not in the ’ol US of A.
  7. Your university almost certain specifies a particular citation style. Specify that in the Bibliography section. My university (ANU) recommends a Author-year style:
  8. In the LaTeX Preamble, add the command , which just points to the previously created preamble file. The main-preamble file is not used by the child documents.
  9. If your using sub-folders for each chapter, place a copy of the thesis.sty and (for ANU) the anuthesis.sty files in the subfolder as well.
The above setup will mean that you can view each chapter separately in LyX using the eye button in the toolbar. The chapter can be viewed within the whole-thesis PDF using the button. When viewing separately, the bibliography references will display as question marks (?), whereas they will be displayed correctly in the whole-thesis PDF. There are some suggested work-arounds for this issue on on the LyX Wiki, but I couldn’t get them to work.

Other productivity enhancements

There is a few additional setup steps you should go through in LyX if you haven’t already. These are not required, but they will generally increase your productivity.

  • Setup Forward and Reverse Search
  • Setup groups of chapters as LyX branches to make sending subsets of your thesis easier
  • Setup math macros
  • Add keyboard shortcuts for citations and cross-references.
​ \usepackage{svn-multi} \svnid{$Id$} \usepackage[hyperindex=true, bookmarks=true, colorlinks=false, pdfborder=0, pagebackref=false, citecolor=blue, plainpages=false, pdfpagelabels, pagebackref=true, hyperfootnotes=false]{hyperref} \usepackage[all]{hypcap} \usepackage[palatino]{anuthesis} \usepackage{afterpage} \usepackage{graphicx} \usepackage{thesis} \usepackage[normalem]{ulem} \usepackage[table]{xcolor} \usepackage{makeidx} \usepackage{cleveref} \usepackage[centerlast]{caption} \usepackage{float} \urlstyle{sf} \renewcommand{\sfdefault}{uop} \usepackage[T1]{fontenc} \usepackage[scaled]{beramono} \usepackage{pifont} \usepackage{rotating} \usepackage{algorithmic} ​ \usepackage{multirow} ​ %%%% Old macros file includes \usepackage{booktabs} \usepackage{relsize} \usepackage{xspace} \usepackage{subfig} \usepackage{listings} %%%%%%%%
\setlength{\parindent}{0cm} \setlength{\parskip}{4mm plus2mm minus3mm}
\makeatletter \AtBeginDocument{ \hypersetup{ pdftitle = {\@title}, pdfauthor = {\@author} } } \makeatother ​ \title{Advances in stuff} \author{John Smith} \date{\today} ​ \renewcommand{\thepage}{\roman{page}}
\input{general-preamble} \input{main-preamble}
bibtool -s -d *.bib > all.bib

0 Replies to “Lyx Tutorial Bibliography”

Lascia un Commento

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *