Lyx Bibliography Without Numbers For Kids

On By In 1

Lyx bibliography sorting order is not automatic? Help!

Postby serratus » Thu Sep 18, 2008 10:17 pm

I'm new to LaTeX and Lyx but have read a lot on Lyx and started to write my thesis in it. Right now, I'm finding that when adding a bibliographical entry, Lyx does not automatically insert it into the correct order and update the numbers. It's probably easier to describe what I'm saying by using a simple example:

Normally, you want something like this:

Text text text [1], text more text
more text [2] more text [3]

Bibliography
[1] google
[2] yahoo
[3] msn

from the following Lyx code:

Text text text [google-key], text more text
more text [yahoo-key] more text [msn-key]

Bibliography
[google-key] google
[yahoo-key] yahoo
[msn-key] msn


Now, the problem is if you started adding more text and more bibliographies. For example I end up with this mess:

Text text text [1], text more text
ADDED LINE[4] HERE
more text [2] more MORE ADDED TEXT AND REFERENCE [5] text [3]

Bibliography
[1] google
[2] yahoo
[3] msn
[4] logitech
[5] samsung

from the following Lyx code:

Text text text [google-key], text more text
ADDED LINE[new_logetech-key] HERE
more text [yahoo-key] more MORE ADDED TEXT AND REFERENCE [new_samsung-key] text [msn-key]

Bibliography
[google-key] google
[yahoo-key] yahoo
[msn-key] msn
[new_logetech-key]
[new_samsung-key]


Now, what I want is to have the final output to have numbers [1] to [5] in chronological order. The quick solution is to insert the
[new_logetech-key]
[new_samsung-key]
into the 2nd and 4th entries in the bibliography instead at the end, but finding and inserting in the correct order is not practical when inserting chapters together for a thesis with numerous references. Wasn't the point of Lyx to help do these kind of things automatically?

BTW, I'm not using BibTeX and would love to learn how because I bet Lyx doesn't screw up the order when using BibTeX. Is there a good GUI that helps with making the BibTeX databases for windows? Anyhow, is there some command in Lyx that will automatically sort this properly in chronological order of appearance in the thesis? or am I forced to learn BibTeX?

Categories: Bibliography, Tips

<< | Page list | >>

Encoding

BibTeX does not support files encoded in UTF-8 (i.e., Unicode), which is nowadays the default file encoding on most OSes. The reason is that current BibTeX (v. 0.99c) was released in 1988 and thus predates the advent of unicode. Unless the long-announced BibTeX v. 1.0 or one of the many planned potential successing applications are ready, latin1 (ISO-8859-1) or another 8-bit encoding has to be used for the bib file (this does not affect the LaTeX encoding, which still can be utf8).

If you rely on UTF-8, you might try biblatex-biber, a BibTeX replacement program written in Perl. Biber can handle unicode, however, as the name indicates, it only works in conjunction with biblatex. Please look here for some instructions.

Decent bib file editors take care about the correct encoding, which usually can be set in the Preferences or Options dialog of the bib file editor. However, you might have to take care yourself about special characters. Particularly, characters not included in the bib file encoding need to be inserted via LaTeX macros. (Some editors automatically do this conversion for you, e.g. Pybliographic and BibDesk. In the latter application, you need to check "Convert accented characters to TeX when exporting or pasting BibTeX" in the "Opening and Saving" preferences.)

Existing utf8-encoded bib files can be converted by means of the command line tool recode. The following command (with an adapted bib file name) should do the trick (however, please backup your bib file before trying):

This re-encodes the file to 7-bit ASCII.
If you want another target encoding, change the syntax. For ISO-8859-15 (= latin9), the command would read:

Please check the recode man page for more options.

Some background information:

Change bibliography heading

You can change the heading of your bibliography by inserting a ERT element (Insert→TeX) right before the bibliography with the following command: \renewcommand\refname{New References Header} or \renewcommand\bibname{New Bibliography Header}, depending on whether you use an article or a report/book class.

Cf. the FAQ for a more general explanation.

Cross references vs. explicit references

BibTeX adds cross-referenced entries to the bibliography even if they are not explicitly referenced when those entries are cross-referenced by two or more citations. The -min-crossrefs option can be used to disable or customize this behavior.

As of LyX 1.4, you can customize the way bibtex is called (in Preferences→Output→LaTeX). Add the option there, e.g.

.

With LyX < 1.4, the bibtex call was hardcoded. To customize , you will have to create a shell script containing the following:

Name the script 'bibtex' and make sure it appears on the search path before the real bibtex executable.

Abbreviation of author name in text

If you want to abbreviate an author (or most likely institutional) name in the citation while having it in full form in the bibliography, the procedure depends on the citation approach.

Biblatex and jurabib have the field, which can be used for this task.

Example:

@techreport{FEMA350, author = {{Federal Emergency Management Agency (FEMA)}}, shortauthor = {FEMA}, title = {Recommended seismic design criteria for new steel moment-frame buildings}, year = 2000, number = {FEMA-350}, address = {Washington, D.C.} }

With natbib, things are more complicated. You need to define a cite alias.

  1. At the beginning of the LyX file enter as TeX code: \defcitealias{<citekey>}{<alias>}
    (e.g., for the above example: \defcitealias{FEMA350}{FEMA}
  2. At the location of the citation enter in TeX code \citealias{<key>}
    (e.g., \citealias{FEMA350} followed by a normal LyX citation reference to this item using the style that only outputs the year.

Multiple and subdivided bibliographies

Subdivided bibliographies

As of LyX 1.4, subdivided bibliographies are natively supported via the bibtopic package:

  1. Go to Layout→Document→Bibliography and select Sectioned bibliography (or Subdivided bibliography, as of LyX 2.3).
  2. Now you can just insert several Bibtex Insets (Insert→Lists&TOC→BibTeX Reference).

Note, though, that bibtopic does not support unsorted bibliographies.
See section 3.1.2 of Help→Additional Features for details.

With LyX < 1.4, you have to use TeX code as described in the bibtopic manual. N.B.: You have to call the package in the preamble with the command

\usepackage[dot]{bibtopic}

Without the dot-option, LyX won't find the auxiliary files, hence the bibliography will be empty.

Biblatex provides its own means to produce subdivided bibliographies (via keywords, filter tags, and categories). These are described on the biblatex manual, section Subdivided bibliographies

Multiple bibliographies

Multiple bibliographies will be supported as of LyX 2.3 (using, depending on the setting, either the bibtopic or chapterbib package, or biblatex):

  1. Go to Layout→Document→Bibliography and select the relevant unit from Multiple bibliographies.
  2. Now you can just insert several Bib(la)tex Insets (Insert→Lists&TOC→Bib(la)TeX Reference).

See section 3.1.2 of Help→Additional Features for details.

Up to LyX 2.2, you can produce multiple bibliographies with bibtopic, chapterbib or biblatex as follows:

  • bibtopic:
    1. Go to Layout→Document→Bibliography and select Sectioned bibliography
    2. Wrap the respective units (chapters, sections etc.) into \begin{btUnit} ... \end{btUnit} in TeX mode.
    Note that all references need to be in a , and that must not be nested. Note further that bibtopic does not support unsorted bibliographies (as mentioned above).
  • chapterbib:
    1. Add the following to Document→Settings...→Preamble:
      \usepackage{chapterbib}
      In case of sections, use \usepackage[sectionbib]{chapterbib} instead.
    2. All chapters or sections need to go to separate child documents, which are included (with not !) to a master document.
    3. You are not supposed to have a bibliography in the master file. BibTeX would yield an error in that case.
    4. Install the python wrapper script bibtexallx. It is needed because LyX does not process bibtex on all of chapterbib's auxiliary files. Place the script somewhere in the path and make sure it is executable. Then go to Tools→Preferences→Output→LaTeX and change the bibtex command from bibtex to bibtexallx (only possible as of LyX 1.4).
  • biblatex: biblatex provides its own methods both for multiple and subdivided bibliographies. If you use biblatex, you will have to use those, since biblatex is not compatible with the aforementioned packages.
    1. See this page for general instructions to use biblatex with LyX < 2.3.
    2. To get a bibliography per chapter, add the package option to the \usepackage[...]{biblatex} call in the preamble (other available values: , , ).
    3. If you do not use biber, but bibtex or bibtex8, you need to install the python wrapper script bibtexallx to let LyX process bibtex on all of biblatex's auxiliary files. Place the script somewhere in the path and make sure it is executable. Then go to Tools→Preferences→Output→LaTeX and change the bibtex command from bibtex to bibtexallx (only possible as of LyX 1.4). If you need bibtex8 instead of bibtex, adapt the script accordingly. However, it is generally advised that you use biber with biblatex.
    See the biblatex manual for details.

If the aforementioned approaches do not fit your needs, you can produce multiple bibliographies with some extra code, using the package bibunits:

  1. Add the following to Document→Settings..→Preamble:
    \usepackage{bibunits}
    \renewcommand{\@bibunitname}{\jobname.\the\@bibunitauxcnt}
  2. Wrap the respective units (chapters, sections etc.) into \begin{bibunit}[<bibstyle>] ... \end{bibunit} in TeX mode, where is your bibliography style without extension.
  3. At the place where the bibliography should occur, enter \putbib[<bibfile>] in TeX mode, where is your bibliography database without extension.
  4. In order to access the citations from the citation dialog, put a BibTeX inset in a note inset.

Also cf. this bibunits example

Creating your own style file with custom-bib

Sometimes it is necessary to change the format of the reference list. Most journals require a certain style; often there are recommendations how to style the reference list when doing a thesis.

The easiest way to accomplish this task is to use plus the latex package from the same author. You can get it in via CTAN.

Once installed, the command line "latex makebst" launches an interactive dialogue. Just keep patiently answering the questions, and you end up with a style file that should come close to your needs. Save that style file in a directory where LaTeX can find it (in your TEXMF directory in the folder ), run to update the LaTeX file database, and in LyX, hit "Rescan" in Tools→TeX Information. After that your new style file is usable in listed in the BibTeX dialog).

When this is done, use natbib (Format→Document→Bibliography→Use natbib). Insert the reference list where you want it to appear (usually at the end of the document). Then select your .bst file as Style.

Creating hyperlinks within a document

Sometimes you might want to employ, say, the numbered style and have hyperlinks from your citations in the document's body text to the appropriate reference in the bibliography. Here's how.

To create hyperlinks within your document, go to Document→Settings...→PDF options and check Enable Hyperref Support.

Make sure that you use in LyX to view the pdf output.

Simply checking this option will make all hyperlinks in your document work, including citations. However, a reader may not notice that the links in your PDF file are clickable. If you wish to color the hyperlinks to increase legibility, add something like in the Additional Options field of that dialog pane.

You can put in any of LaTeX's default colors, i.e. white, black, blue, red, green, yellow, cyan and magenta.

If you still want to do more, combine the commands with other color schemes or packages. For example, add

\usepackage{xcolor}

to the preamble. With you can access several kinds of colors, tints, shades, tones and mixes of colors.

  • results in URLs being displayed blue but only with 50 percent color intensity
  • will result in citations being displayed as a mixture of 20 percent blue and 10 percent green

Categories: Bibliography, Tips

0 comments

Leave a Reply

Your email address will not be published. Required fields are marked *