riboseinc / asciidoctor-bibliography

Citations in AsciiDoc
MIT License
30 stars 8 forks source link

book with editor and no author #68

Closed oliviercailloux closed 6 years ago

oliviercailloux commented 6 years ago

Thanks for this great extension. Very easy to use and useful. When using a reference to an edited book and apa style, the reference shows up incorrectly. Not sure if asciidoctor-bibliography is responsible for this or if there’s a bug in apa style (unlikely) or in zotero export to bibtex (unlikely) or if I’m doing something incorrect (likely).

cite.bib

@book{myref,
    title = {The title},
    editor = {The Editor},
    year = {2010}
}

cite.adoc

= Test
:bibliography-database: cite.bib
:bibliography-style: apa

A test citep:[myref].

bibliography::[]

$ asciidoctor -r asciidoctor-bibliography cite.adoc produces:

Test
A test (2010).
Editor, T. (Ed.). (2010). The title.

but I expected:

Test
A test (Editor, 2010).
Editor, T. (Ed.). (2010). The title.
ronaldtse commented 6 years ago

@oliviercailloux thank you for letting us know!

@paolobrasolin could you help check -- thanks!

paolobrasolin commented 6 years ago

Thanks for the accurate report, @oliviercailloux!

The behaviour you are seeing is expected.

You can achieve the output you desire by using cite instead of citep.

The cite macro renders citations using the style set by the bibliography-style option. The citep macro and its siblings are meant for rendering citations in the traditional LaTeX fashion using the style set by bibliography-tex-style (allowed values are authoryear and numeric).

Does that solve your issue? If you found the manual hazy I'll try to clarify that.

oliviercailloux commented 6 years ago

I am quite sure that \citep in LaTeX would produce the thing I expect: A test (Editor, 2010), rather than the thing I got: A test (2010). (I didn’t check to be honest, but I use LaTeX with zotero since a long time so I would have noticed such an odd behavior.)

ronaldtse commented 6 years ago

@paolobrasolin perhaps @oliviercailloux is correct here?

Natbib: http://merkel.texture.rocks/Latex/natbib.php

In any case, @paolobrasolin could you help update the README so we show the output of the \cite commands for clarity? Thanks.

paolobrasolin commented 6 years ago

I think I get what @oliviercailloux means, now. He is right.

There are many ways to format APA citations in LaTeX: Alan Munn wrote an excellent writeup about that. The essence is that the family of macros including \citep are defined by natbib and depend on its bst styles.

Usually in LaTeX one is used to staying away from \cite because of its inconsistent behaviour no naturally he's trying to use citep.

In asciidoctor-bibliography we have two separated formatting mechanisms:

While the output he expects can be obtained by simply using cite, the reason must be made clearer in the manual.


He also raises a fair point: one might desire a larger choice of styles for the TeX-like macros. I can think of some ways to go about that @ronaldtse:

oliviercailloux commented 6 years ago

But, when I change the :bibliography-style: in my document (where I use exclusively citep and citet), the style changes.

See this source and the resulting pdf. Look at for example the ref to Lipton (last page), you can see the note (“Presented at”, etc.). This is thanks to my custom style apa-note.csl. Whereas if you change the bibliography-style to simply apa, the note disappears. (This is with asciidoctor-pdf but the same thing happens when converting adoc to html.)

Furthermore, I believe that with LaTeX, nat and plainnat, the behavior I am talking about here (the missing editor name) would not happen. (Again, I didn’t check so I might be wrong.)

Thanks for the suggestion: replacing with cite: works around the problem.