zepinglee / citeproc-lua

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

Cite error with commands in prefix #33

Closed nickw2066 closed 1 year ago

nickw2066 commented 1 year ago

This is my JSON file:

[
    {
        "id": "Williams1992-Heaven20",
        "type": "article-journal",
        "author": [
            {
                "family": "Williams",
                "given": "Michael"
            }
        ],
        "title": "Of Heaven and History: The Verticalist Eschatology of Geerhardus Vos",
        "title-short": "Heaven and History",
        "volume": "20",
        "issue": "3",
        "container-title": "Pro Rege",
        "page": "9-18",
        "URL": "https://digitalcollections.dordt.edu/pro_rege",
        "issued": {
            "date-parts": [
                [
                    "1992"
                ]
            ]
        },
        "accessed": {
            "date-parts": [
                [
                    "2022",
                    "12",
                    "13"
                ]
            ]
        }
    }
]

The following code produces the right (expected) output:

% !TEX encoding = UTF-8 Unicode
\documentclass[12pt,oneside]{article}
\usepackage{citation-style-language}
\cslsetup{style = chicago-fullnote-bibliography}
\addbibresource{myBib.json}
\begin{document}
test.\cite[prefix = {See the opposite view in },
page = 1]{Williams1992-Heaven20}
\newpage
\printbibliography
\end{document}

The following code (with the command in the prefix) fails to produce a footnote or final reference:

% !TEX encoding = UTF-8 Unicode
\documentclass[12pt,oneside]{article}
\usepackage{citation-style-language}
\cslsetup{style = chicago-fullnote-bibliography}
\addbibresource{myBib.json}
\begin{document}
test.\cite[prefix = {See the \textit{opposite} view in },
page = 1]{Williams1992-Heaven20}
\newpage
\printbibliography
\end{document}

Thanks, Nick

zepinglee commented 1 year ago

Thanks for your feedback and I can reproduce the bug.

zepinglee commented 1 year ago

Previously the citation prefix was assumed to be a plain string and citeproc-lua didn't recognize LaTeX markups. Now the prefix is parsed to rich text format in CSL v1.1 and the issue should be fixed.