zepinglee / citeproc-lua

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

support for `bibtex`/`natbib` command `\citeyearpar` (equivalent to `biblatex` command `\parencite*`) [improving compatibility] #52

Open saudbinayed opened 5 months ago

saudbinayed commented 5 months ago

I have not tried this package in LaTeX yet, but it looks very handy and a game changer (for sure) to boost citation formatting!

I always work with "author-year" (e.g. Harvard family) citation styles. Usually, I have several citations in the form of "year-only" as the author(s) are typed explicitly in the text. The latex commands are \citeyearpar in natbib/bibtex, or the \parencite* in biblatex.

This package ("citation-style-language"/ "citeproc-lua") appears to not provide the translation of the above ("year-only") citation commands. I have scanned the source files in this repo and found the "suppress-author" property, defined at: #L199

I am curious to see if the following code can provide the needed feature (i.e. to define a translation for the \citeyearpar and \parencite*):

Edits to the file: ./latex/citation-style-language-cite.sty

\NewDocumentCommand \citeyearpar { o o m } { \__csl_cite_year:nnn {#1} {#2} {#3} }

\NewDocumentCommand \parencite*{ o o m } { \__csl_cite_year:nnn {#1} {#2} {#3} }

End of suggestions.

I am not sure if the suggestions above will be successful to add the needed feature to provide compatibility for natbib command \citeyearpar and the equivalent biblatex command \parencite*. In particular, I don't know the actual behaviour of \l__csl_citation_properties_prop { mode } { suppress-author}: does it just print the year-only citation?

Thanks for providing such very practical package.

zepinglee commented 3 months ago

Thanks for you appreciation and the \citeyearpar and \parencite* commands are added in 19cb3f7.