2

I am trying to write my thesis in LyX and want to achieve the following:

My citations should appear as (Doe, 2005) as an inline citation, I also need to be able to cite without parenthesis, as in "According to Doe et al. (2005), ..."

At the same time, I want the bibliography to contain a hyperlinked DOI, but not the URL, if present in the .bib entry. I don't care too much about how exactly the rest bibliography looks like, as long as it's complete.

I don't think that this is a particulary strange need, I generate my .bib files via Mendeley, so sometimes I have some weird and extremely long links in the .bib that would clutter up a nicely formated bibliography. Having a clickable DOI seems to be fairly obvious need to me, as most documents are nowadays circulated as pdfs.

So far I had only limited success: The .bst style files I could find are not Natbib compliant and produce numbered inline citations only. Or, I am getting everything wrong and don't understand how to properly set the style of the inline citation... thanks for help.

4
  • I believe that LyX uses (or can use) BibTeX, but probably not BibLaTeX. You will have to use the correct profile (i.e. one that uses BibTeX) and chose a suitable citation style. The natbib package is most suitable for author-year citations as you want them. With natbib, \citet{KEY} produces "Author (year)" and \citep{KEY} produces "(Author, year)". You will have to find a suitable \bibliographystyle{} to fit your needs, though. Apr 4 '17 at 12:56
  • Thank you for your answer. I am using natbib to get my inline citations to look corrrect. However, I can't use styles like this or this because the compiler complains: Check the bibliography entries for non-compliant syntax, or select author-year BibTeX style, e.g. plainnat. I don't want to use plainnat obviously, and my .bib is mendeley autogenerated and looks fine. I found an answer that a missing year entry can cause this error too, but all my entries have years and authors.
    – grg rsr
    Apr 4 '17 at 13:54
  • I do not know why exatctly you get that error, but both .bst files are obviously numeric citation styles, not suitable to produce what you want anyways. If you do not want to use plainnat, look for another style in the author-year format (e.g. apalike), or create your own using makebst. Apr 4 '17 at 15:20
  • I was looking for another style but couldn't find one. Thank you for mentioning makebst, I didn't know that program!
    – grg rsr
    Apr 4 '17 at 15:39
1

Ok I got it to work. Here is a not really good solution, in case another LyX user stumbles over this.

  1. Choose Natbib as citation style in the Bibliography pane in the document settings
  2. add round to Custom Class Options at the Document Class pane in the document settings. While this makes no sense to me, this option (!) is forwarded to Natbib.
  3. add \usepackage{doi} to your preamble
  4. I took plainnat as a template and removed all lines that included url except the last 4 (all in the function begin.bib)

did a similar thing with apalike-refs removing the ISBN and ISSN functions. Works and looks a bit better ...

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.