LyX and jurabib

I’m using jurabib for citation in the humanities. Since LyX jurabib support is incomplete I’ve come up with the following solution to “hack” the preamble and document. Just include it in a LyX template and don’t worry about it no more.

Update: It was pointed out to me on the lyx-users mailing list that there is a better way to do it. Take a look in the LyX wiki for more on that.

The following is now deprecated, please take a look in the LyX wiki for instructions.

First I include the following in the preamble to control the citation style:

usepackage{babel}
usepackage[%
titleformat=italic,%
titleformat=commasep,%
commabeforerest,%
ibidem=strict,%
citefull=first,%
lookat,%
oxford,%
pages=format,%
idem%
]{jurabib}
renewcommand{cite}{footcite}

This is just an example style using the latest version of jurabib (v0.6). Take a look at the jurabib web site and documentation for more information. As you can see jurabib is flexible and you can tailor the style with just a couple of parameters.

I’ve also made the cite command an alias to footcite so that I can insert citation as usual in LyX but they will still end up as foot notes.

And because I’m not going to use the regular bibliography formating but jurabibs footnote I must insert the following code in the document, presumably last. Using Insert > TeX Code and put the following in the ERT block:

bibliographystyle{jox}%
nobibliography{jbtest}

But this alone will not make it possible to use the LyX support for looking up and inserting citation. To enable that I must also insert a regular BibTex Bibliograhy as usual and select the BibTex database to be used. Of course this will give me a regular bibliography at the end of the document (or wherever I decided to insert it). Since that bibliography is only a concern for LyX and not the final LaTeX document I’ve come up with an rather elegand solution: Put the BibTex Bibliography in a LyX Note block! That way LyX will still find the BibTex database but the bibliography code it generate will never reach the LaTeX processor.

The hiding only works in LyX 1.4, in LyX 1.3.6 you need to have the BibTeX Bibliography block outside any notes. The problem is that you will end up with an empty bibliography list and a header. To remove it I insert the following code in an ERT block right before the BibTeX Bibliography:

renewcommandrefname{}

For articles, or the following for reports and books:

renewcommandbibname{}

This remove the header, there is still an extra empty page. Less smooth but it works too. Or just upgrade to LyX 1.4.

All this is somewhat “hackish” solution but at least a working one until LyX get complete support for jurabib.

This entry was posted in Tutorials and tagged . Bookmark the permalink. Both comments and trackbacks are currently closed.

One Comment

  1. Boris
    Posted July 9, 2007 at 18:25 | Permalink

    HEy Danielson

    thanks for your aproach. Have you managed to work out a better solution?

    I have the follwing code for ‘humanities’ / MLA style and I am not able to get it work.
    Ok the first lines need to be taken out since LYX has its own options. But how do I integrate all the redefinitions? I always receive some error code :(

    ————————-
    documentclass[12pt, oneside, a4paper, BCOR14.5mm, DIV12, headsepline, normalheadings, draft]{scrreprt}
    usepackage{mathptmx}
    usepackage[latin1]{inputenc}
    usepackage[T1]{fontenc}
    usepackage{graphicx,textcomp,booktabs,amsmath}
    usepackage{setspace}doublespacing
    %onehalfspacing %

    % from here on I believe it shold only be prompted to LYX preamble settings…

    usepackage[UKenglish]{babel}
    usepackage{mla6}

    jurabibsetup{
    authorformat={citationreversed,reducedifibidem,firstnotreversed},
    citefull=first,
    round,% — JMC
    endnote=false,% — JMC
    annotatorfirstsep=qtd,% — JMC
    % idem=strict,% — JMC %—->the MLA Handbook says those options should be avoided, if, however, you want to use them, delete the %
    % ibidem=strict,% — JMC %—->the MLA Handbook says those options should be avoided, if, however, you want to use them, delete the %
    % pages=ignoreibidem,% — JMC (new option in latest beta) crossref=long %—->the MLA Handbook says those options should be avoided, if, however, you want to use them, delete the %
    crossref=long,
    titleformat=commasep,
    bibformat=ibidem,
    }

    AddTobibsenglish{%
    defedbyname{}
    defEdbyname{ed.}
    definname{unskip}
    defeditorname{unskip,space ed.}
    defeditorsname{unskip,space eds.}
    defetalname{et alperiodn}
    renewcommand*{trans}{trans.}
    renewcommand*{ibidemname}{}
    renewcommand*{ibidemmidname}{}
    renewcommand*{idemname}{}
    renewcommand*{idemmidname}{}
    renewcommand*{firstedname}{1textsuperscript{st}}
    renewcommand*{secondedname}{2textsuperscript{nd}}
    renewcommand*{thirdedname}{3textsuperscript{rd}}
    renewcommand*{fourthedname}{4textsuperscript{th}}
    renewcommand*{fifthedname}{5textsuprescript{th}}
    renewcommand*{thedname}{textsuperscript{th}}
    renewcommand*{editionname}{ed.}
    renewcommand*{urldatecomment}{unskipcommas}
    biburlfont{rm}
    }
    addtojbonlyforbib{%
    DeclareRobustCommand{mla}{. }
    DeclareRobustCommand{mlaws}{.}
    DeclareRobustCommand{commas}{ }
    DeclareRobustCommand{periodn}{}
    DeclareRobustCommand{nosnoc}{.}
    DeclareRobustCommand{commanot}{}
    DeclareRobustCommand{nocolon}{:}
    DeclareRobustCommand{diss}{Diss}
    DeclareRobustCommand{perf}{Perf.}
    DeclareRobustCommand{dir}{Dir.}
    DeclareRobustCommand{reviewintro}{Rev. of }
    DeclareRobustCommand{specintro}{Spec. issue of }
    DeclareRobustCommand{Edbyname}{Ed.}
    DeclareRobustCommand{editorname}{unskip,space ed}
    DeclareRobustCommand{editorsname}{unskip,space eds}
    DeclareRobustCommand{revedname}{Rev.}
    DeclareRobustCommand{editionname}{ed}
    DeclareRobustCommand{trans}{Trans.}
    DeclareRobustCommand{bibapyldelim}{}
    DeclareRobustCommand{bibapyrdelim}{}
    renewcommand*{bibtfont}{textit}
    renewcommand*{bibbtfont}{textit}
    renewcommand*{bibjtfont}{textit}
    renewcommand{bibauthormultiple}{—. }
    }