andras-simonyi / citeproc-el

A CSL 1.0.2 Citation Processor for Emacs.
GNU General Public License v3.0
85 stars 9 forks source link

[Feature Request] Allow deactivating case conversion when exporting files #119

Closed dangom closed 1 month ago

dangom commented 1 year ago

Hi Andras,

following up on the thread started at the org-ref repo, I was wondering whether it be possible to deactivate the case conversion on a per export basis. In specific, I'd like to be able to insert contents of the title field of a bibfile verbatim.

I should note it'd be great if this would apply not only to titles, but author and journal names as well (I could foresee McLaren, e.g., being converted to Mclaren, and NeuroImage to Neuroimage).

Regards, Daniel

dangom commented 1 year ago

I should also note I'm not an expert in latex, but I never had any issues like this with standard LaTeX where the names of the journals would be capitalized. So I guess what I'm asking is for citeproc to mimic the bibtex/biblatex behaviour.

bdarcus commented 1 year ago

Isn't the issue really that it turns an acronym into a standard word; e.g. you really want to preserve the case of that substring?

dangom commented 1 year ago

It turns acronyms into standard words, and also changes names (McDowell -> Mcdowell). In org-ref importing citations into a bibfile also gets them case-converted so I have to manually fix them, and then they get converted again on export. I just wish capitalization would not ever be touched and bibfiles were used as sole source of truth.

bdarcus commented 1 year ago

I just wish capitalization would not ever be touched and bibfiles were used as sole source of truth.

But that's not how publishing styles work in the main. Most specify rules for capitalization, which necessarily requires transformation.

So the bib formats require a way to specify text that doesn't get transformed, like those two cases.

 title =        {Deconvolution of Impulse Response in Event-Related {BOLD fMRI}},

Does citeproc not honor that?

dangom commented 1 year ago

Yes, citeproc does honor that. So I take the fix is to have the import of bibfiles automatically take care of acronyms

andras-simonyi commented 1 year ago

To clarify, the bib(la)tex->CSL entry converter in citeproc-el is supposed to sentence-case only title fields; if it changes the case of other fields then that is a bug and please report it. As for sentence-casing titles, I've checked now the code and the function called by org-ref (citeproc-hash-itemgetter-from-any) already has an argument for turning off sentence-casing when no langid is given, so the simplest solution would be for org-ref (@jkitchin) to call it with no-sentcase-wo-langid set to non-nil, or maybe to introduce a user-customizable option for this (citeproc-el tries to avoid introducing user options by design).

Note that -- as @bdarcus wrote -- the final formatting of titles in the rendered bibliography is determined by the CSL style, the suggested changes would affect only the input of the CSL processor.

andras-simonyi commented 1 month ago

I've now pushed a commit to org-mode's main branch which introduces a new user option, org-cite-csl-bibtex-titles-to-sentence-case, which can be used to turn off sentence-casing titles in entries that don't have an explicit English langid, and other packages relying on citeproc-el can introduce similar user options if they are needed, as the required citeproc arguments are already in place, so I'm planning to close this issue.