andras-simonyi / citeproc-org

Renders Org-mode citations in CSL styles using citeproc-el.
GNU General Public License v3.0
69 stars 2 forks source link

Honor `#+language:` #18

Open EmmanuelCharpentier opened 3 years ago

EmmanuelCharpentier commented 3 years ago

First and foremost : thank you for this : the ability of cite and reference is vital to scientific writing (not limited to academic...) and org-mode lacking it was slowly pushing me to reverting to LaTeX w. cut-and-paste + awkward conversion to .doc for my Latex-shy colleagues. Your processor is a life saver...

Now, I notice that the language: fr option is without effect on org-citeproc output : the "References" section, which should be something like "Bibliographie", or maybe "Références", remains "Bibliography". Sore eye...

What could be done to enhance the situation ?

andras-simonyi commented 3 years ago

Hello, thanks, it is nice to hear that you find the package helpful. In one respect citeproc-org already honors the language setting, which might be useful for you: it uses the corresponding CSL locale if the locale file is available. This means that if the French CSL locale file is available, then rendering language: fr documents will automatically use French locator names etc. As for the heading of the bibliography section, it can be changed by setting the citeproc-org-org-bib-header, citeproc-org-html-bib-header and citeproc-org-latex-bib-header (depending on the target export format), so one way of providing more flexibility could be setting these variables to "" and adding the desired heading manually. Another option would be to allow these variables to contain mappings from language codes to strings -- would you find this a better solution?

EmmanuelCharpentier commented 3 years ago

Dear Andras,

Thank you for your prompt answer. I could test it (successfully) with the org-ref syntax (with a snag I'll report in a new issue). A couple remarks :

it uses the corresponding CSL locale if the locale file is available

What is this beast ? More precisely :

Such a beast deserves mention in the documentation (including your README.org...).

it can be changed by setting the citeproc-org-org-bib-header, citeproc-org-html-bib-header and citeproc-org-latex-bib-header

Thanks : I could indeed set header to my preferences (an unnumbered french header).

By the way : the doc might also suggest to use the citeproc processor for all exports, in order to get consistent reference list when exporting to various formats (e. g. PDF, ODT, HTML), which is a god use case of Org...

Another option would be to allow these variables to contain mappings from language codes to strings -- would you find this a better solution?

Indeed. But this would entail a lot of maintenance work, problematic if you are not a polyglot. The "CSL locale" you mentioned earlier seems more applicable.

Thanks again !

andras-simonyi commented 3 years ago

Dear Emmanuel,

it uses the corresponding CSL locale if the locale file is available

What is this beast ? More precisely :

* Where can it be found ?

* How could I install it ?

(at least for our purposes here..) CSL locales are files containing language-specific details about how bibliographic references should be formatted: translations of terms, punctuation etc. They can be downloaded from here: https://github.com/citation-style-language/locales

Once you downloaded the locales for the languages you intend to use, put them in a directory somewhere on your system and set the citeproc-org-locales-dir accordingly:

(setq citeproc-org-locales-dir [directory containing the locales])

the directory should contain at least the fallback en-US locale.

Such a beast deserves mention in the documentation (including your README.org...).

maybe it could be more extensive but there is a section about locales in the README.

By the way : the doc might also suggest to use the citeproc processor for all exports, in order to get consistent reference list when exporting to various formats (e. g. PDF, ODT, HTML), which is a god use case of Org...

thanks, there are some hints but could be more explicit, I agree.

best wishes, András