Edit Links |
BibTeX /
Tips
<< Emacs' bibtex-mode | Page list | Tips and Tricks for using Jurabib >>
EncodingBibTeX 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 really rely on UTF-8, you might try biblatex-biber, a BibTeX replacement program written in Perl. Biber can handle unicode – for that matter, it assumes unicode-encoded data by default – and, as the name indicates, it only works in conjunction with biblatex. Both biblatex and biber are still beta software, but they are already pretty stable) 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): recode -d u8..ltex myfile.bib
Some background information:
Change bibliography headingYou 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 referencesBibTeX 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. In LyX 1.4, you can customize the way bibtex is called (in Preferences→Output→LaTeX). Add the bibtex -min-crossrefs=200.
With LyX < 1.4, the bibtex call was hardcoded. To customize /path/to/bibtex -min-crossrefs=200 "$@"
Name the script 'bibtex' and make sure it appears on the search path before the real bibtex executable. Abbreviation of author name in textBibtex-Entry Example: @techreport{FEMA350, author = {{Federal Emergency Management Agency (FEMA)}},
title = {Recommended seismic design criteria for new steel moment-frame buildings},
year = 2000,
number = {FEMA-350},
address = {Washington, D.C.}
} Defining the alias at the beginning of the LyX file in ERT \defcitealias{FEMA350}{FEMA} At the location of the citation use in ERT \citetalias{FEMA350} Followed by a normal LyX citation reference to FEMA350 with Citation Style selected to only give the date The result is "FEMA 2000" in the text and "Federal Emergency Management Agency (FEMA)..." in the bibliography see:
* http://www.mail-archive.com/lyx-users@lists.lyx.org/msg43232.html * http://thread.gmane.org/gmane.editors.lyx.general/50138
* http://bugzilla.lyx.org/show_bug.cgi?id=5266 Examples of BibTeX-files
Multiple and sectioned bibliographiesLyX 1.4 has native support for the bibtopic package, which produces sectionated bibliographies (please note that bibtopic does not support unsorted bibliographies). To use bibtopic, go to Layout→Document→Bibliography and select Sectionated bibliography. Then you can just insert several Bibtex Insets (Insert→Lists&TOC→BibTeX Reference). See section 3.1.2 of Help→Extended Features for details. With LyX < 1.4, you have to use ERT 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. Multiple bibliographies, e.g. bibliographies for each chapter, can be produced with the packages chapterbib, bibunits, and also with bibtopic.
Also cf. this bibunits example
Creating your own style file with custom-bibSometimes 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 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 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 documentSometimes you might want to employ, say, the To create hyperlinks within your document, put \usepackage{hyperref}
at the very end of the preamble -- make sure that it is the very last package. Make also sure that you use Simply including this command 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, use something like \usepackage{hyperref} \hypersetup{colorlinks=true,citecolor=blue} where you can use the color specific options of the \hypersetup command, such as
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
Categories: Bibliography, Tips |