zepinglee / citeproc-lua

A Lua implementation of the Citation Style Language (CSL)
MIT License
62 stars 7 forks source link

Add support for annotated bibliography #64

Closed zepinglee closed 3 weeks ago

zepinglee commented 4 weeks ago

Originally posted by @HiramTheHero in https://github.com/zepinglee/citeproc-lua/issues/17#issuecomment-2137649875

In my case I need to create an annotated bibliography using APA 7 formatting. It requires me to use the \fullcite command.

As far as I know, it's easier to create an annotated bibliography with the apa-annotated-bibliography.csl style. Yet there are some problems with the current citeproc-lua engine implementation. I'll fix them later.

zepinglee commented 4 weeks ago

See the test example annotated-bibliography.lvt.

Screenshot 2024-06-04 at 11 44 38
HiramTheHero commented 3 weeks ago

Thank you for the work on this package.

I forgot about other .csl styles that could address my use case of needing full citations.

According to the APA 7 Publication manual, the APA 7 Annotated Bibliography looks like the following:

Screen Shot 2024-06-04 at 10 52 20 AM

This formatting requires a full citation to be done, and then the writer gives a synopsis about the citation. Recreating this requires that a full citation is created every time the \cite command is used. The apa-annotated-bibliography.csl doesn't provide this functionality. Ever time the \cite command is used with this style, it creates an in-text citation like the normal APA styling. The difference between the two is in the formatting of the formal bibliography at the end of the paper. However, the apa-cv.csl does create a full citation when using the general \cite command.

So, for my use case of the APA 7 Annotated Bibliography, using the apa-cv.csl style gets the job done well.

I hope this gives insight and provides some closure on the use case I specified. Please let me know if you have any questions, or if I didn't explain things clearly.

zepinglee commented 3 weeks ago

This formatting requires a full citation to be done, and then the writer gives a synopsis about the citation. Recreating this requires that a full citation is created every time the \cite command is used.

My previous understanding was that such annotated bibliography was created from a \printbibliography command which did the formatting jobs like line spacing and hanging indentation. Is it more convenient to use \cite-like commands with an explicit list environment (perhaps description)?

The apa-annotated-bibliography.csl doesn't provide this functionality. Ever time the \cite command is used with this style, it creates an in-text citation like the normal APA styling.

The \nocite command doesn't produce in-text citation but adds the entry into the \printbibliography. I'm not sure if this is suitable in your case.

I'm still a little confused after reading section 9.51. Do you mean the items in the annotated bibliography are not cited in the main text? Then what about the cited references? Does the article have a separated list of cited work along with the annotated bibliography?

The \fullcite command you mentioned is possible to implement. However it's not trivial since we need to add a new mode in the Lua citeproc engine. I'll have a try.

HiramTheHero commented 3 weeks ago

Thank you for your response.

I'm still a little confused after reading section 9.51. Do you mean the items in the annotated bibliography are not cited in the main text?

That is correct. In the case of my assignment, my professors want me to create an annotated bibliography of all the academic sources I researched outside of course work. There is no article I'm creating in conjunction with the annotated bibliography. There is just me putting down the full citation for the resource and then writing a description about the resource. No additional bibliography is appended to the end of the document. So, in the case of my assignment, I don't even use the \printbibliography command.

The \fullcite command you mentioned is possible to implement. However it's not trivial since we need to add a new mode in the Lua citeproc engine. I'll have a try.

In my case, the benefits of a \fullcite command would be that I could have just chose the apa style when loading the citation-style-language package and then could use the \fullcite command instead of having to hunt down the apa-cv.csl style file.

Thank you for your work on this excellent software.

zepinglee commented 3 weeks ago

That is correct. In the case of my assignment, my professors want me to create an annotated bibliography of all the academic sources I researched outside of course work. There is no article I'm creating in conjunction with the annotated bibliography. There is just me putting down the full citation for the resource and then writing a description about the resource. No additional bibliography is appended to the end of the document. So, in the case of my assignment, I don't even use the \printbibliography command.

Ah, I see.

I've just added the \fullcite command. Can you test it with the GItHub main branch of the repository? I'll then make a release to CTAN if it works.

HiramTheHero commented 3 weeks ago

Thank you for your hard work.

I tested the update and it is ALMOST there. The new \fullcite command creates a full citation, but it does not format multiple authors names properly. It looks like it is formatting the authors name similar to a \cite command. To my understanding the \fullcite should create the same entry that would be found in the bibligraphy. See the attached screenshot for an example. To my understanding the result of the \fullcite should not create an "et al" in it, but list the authors names like in the bibliography entry. Please let me know if you have further questions, or if I need to clarify. Thank you, again, for your amazing work on this package.

Screen Shot 2024-06-08 at 7 36 37 PM

Latex code is below:

\documentclass{article}

\usepackage{citation-style-language}
\cslsetup{style = apa}
\addbibresource{annotated_bib_year_2.json}  % or example.bib or example.yaml

\begin{document}

This is from a cite command: \cite{acheampongExaminingVaccineHesitancy2021}. 
\vspace{1cm}

This is from a fullcite command:

\vspace{.5cm}
\fullcite{acheampongExaminingVaccineHesitancy2021}.
\vspace{.5cm}

This is from a printbibliography command:

\printbibliography

\end{document}

CSL JSON entry is below:

{
    "id": "acheampongExaminingVaccineHesitancy2021",
    "abstract": "The impact of COVID-19 vaccination programmes on disease transmission, morbidity and mortality relies heavily on the population’s willingness to accept the vaccine. We explore Ghanaian adult citizens’ vaccine hesitancy attitudes and identify the likelihood of participation or non-participation in the government’s effort to get citizens vaccinated. A fully anonymised cross-sectional online survey of 2345 adult Ghanaians was conducted from 23 to 28 February 2021. Differences in intentions regarding COVID-19 vaccination were explored using Pearson Chi-square tests. Additionally, multinomial logistic regression was used to analyse the factors associated with willingness to receive vaccines. Responses were weighted using the iterative proportional fitting technique to generate a representative sample. About half (51%) of mostly urban adult Ghanaians over 15 years are likely to take the COVID-19 vaccine if made generally available. Almost a fifth (21%) of the respondents were unlikely to take the vaccine, while another 28% were undecided. Additionally, we find differences in vaccine hesitancy among some socio-demographic characteristics such as age, gender, and primary sources of information. Attaining the proverbial 63% to 70% herd immunity threshold in Ghana is only possible if the preventive vaccination programmes are combined with an enhanced and coordinated public education campaign. Such a campaign should focus on promoting the individual and population-level benefits of vaccination and pre-emptive efforts towards addressing misinformation about vaccines.",
    "author": [
      {
        "family": "Acheampong",
        "given": "Theophilus"
      },
      {
        "family": "Akorsikumah",
        "given": "Eli A."
      },
      {
        "family": "Osae-Kwapong",
        "given": "John"
      },
      {
        "family": "Khalid",
        "given": "Musah"
      },
      {
        "family": "Appiah",
        "given": "Alfred"
      },
      {
        "family": "Amuasi",
        "given": "John H."
      }
    ],
    "citation-key": "acheampongExaminingVaccineHesitancy2021",
    "container-title": "Vaccines (Basel)",
    "DOI": "10.3390/vaccines9080814",
    "event-place": "BASEL",
    "ISSN": "2076-393X",
    "issue": "8",
    "issued": {
      "date-parts": [
        [
          "2021"
        ]
      ]
    },
    "language": "English",
    "page": "814",
    "publisher": "Mdpi",
    "publisher-place": "BASEL",
    "title": "Examining Vaccine Hesitancy in Sub-Saharan Africa: A Survey of the Knowledge and Attitudes among Adults to Receive COVID-19 Vaccines in Ghana",
    "type": "article-journal",
    "URL": "https://go.exlibris.link/sSD3QCCZ",
    "volume": "9"
  }
zepinglee commented 3 weeks ago

Yes, I can reproduce this bug. It is because the configurations for name abbreviation (et-al-min and et-al-use-first) are incorrectly taken from the <citation> element rather than <bibliography>.

https://github.com/zepinglee/citeproc-lua/blob/31ebc1d22b83ebe2a03ceb2d0901127389f0f24b/submodules/styles/apa.csl#L1805

https://github.com/zepinglee/citeproc-lua/blob/31ebc1d22b83ebe2a03ceb2d0901127389f0f24b/submodules/styles/apa.csl#L1820

This should be fixed in 49799fd.

HiramTheHero commented 3 weeks ago

I just tested the package with your new commit and it is working great. Thank you, again, for your excellent work.

zepinglee commented 3 weeks ago

I've released v0.5.0 to CTAN. Please let me know if you have further issues.