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

Names with name particles #74

Closed Quintus closed 2 years ago

Quintus commented 2 years ago

Dear Andras,

take this Biblatex bibliography:

@Article{vhellfeld1989alg,
  author       = {Axel von Hellfeld},
  title        = {Sind Algorithmen schutzfähig?},
  journaltitle = {Gewerblicher Rechtsschutz und Urheberrecht},
  shortjournal = {GRUR},
  year      = {1989},
  pages     = {471-485},
  langid    = {german}}

This person's name has what CSL calls a non-dropping name particle (von, a German “Adelsprädikat”). If I read the CSL 1.0.1 specification correctly, then

<names variable="author" font-style="italic">
  <name form="short" delimiter="/"/>
</names>

in the XML should evaluate to von Hellfeld, but it does not. It always yields Hellfeld. Below is an adapted version of juristische-schulung.xml using this construct in the author-note macro referenced by the formatting rule for article-journal. The original juristische-schulung.xml uses

<names variable="author" font-style="italic">
  <name form="short" delimiter="/" name-as-sort-order="all"/>
</names>

But that doesn't seem to cut it either; it also yields Hellfeld rather than von Hellfeld. Is this a bug or do I misinterpret the CSL specification?

There's a second problem buried in here, which is that in German we shorten von to v. in citations, but before I can think about that one the von needs to be displayed at all.


<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" class="note" default-locale="de-DE">
  <info>
    <title>Juristische Schulung (Deutsch)</title>
    <title-short>JuS</title-short>
    <id>http://www.zotero.org/styles/juristische-schulung</id>
    <link href="http://www.zotero.org/styles/juristische-schulung" rel="self"/>
    <link href="http://www.zotero.org/styles/neue-juristische-wochenschrift" rel="template"/>
    <link href="http://rsw.beck.de/rsw/upload/JuS/jusautorenhinweise.pdf" rel="documentation"/>
    <author>
      <name>Reto Mantz</name>
    </author>
    <category citation-format="note"/>
    <category field="law"/>
    <issn>0022-6939</issn>
    <summary>JuS
    Style for articles in German law journal JuS
    - based on style Neue Juristische Wochenschrift (NJW) http://www.zotero.org/styles/neue-juristische-wochenschrift
    - Commentaries and handbooks should use publication type "entry-encyclopedia". See details for different citations below.
    - If a book or entry-encyclopedia is cited for the 2nd time (or more), "title and edition" are substituted by (o. Fn. ...)
      (see footnote ...)
    - see more details below in the comments</summary>
    <updated>2014-12-09T13:38:27+00:00</updated>
    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
  </info>
  <!-- set date to format 8. 8. 2014 -->
  <locale xmlns="http://purl.org/net/xbiblio/csl" xml:lang="de-DE">
    <date form="numeric">
      <date-part name="day" form="numeric" suffix=". "/>
      <date-part name="month" form="numeric" suffix=". "/>
      <date-part name="year"/>
    </date>
  </locale>
  <macro name="author">
    <names variable="author" font-style="italic">
      <name delimiter="/ " name-as-sort-order="all" sort-separator=", " form="long"/>
      <label form="short" prefix=" (" suffix=")"/>
      <substitute>
        <names variable="editor"/>
      </substitute>
    </names>
  </macro>
  <macro name="author-note">
      <names variable="author" font-style="italic">
          <name form="short" delimiter="/"/>
      </names>
  </macro>
  <macro name="author-commentary">
    <choose>
      <if variable="collection-editor">
        <names variable="collection-editor">
          <name form="short" delimiter="/" name-as-sort-order="all"/>
        </names>
      </if>
      <else>
        <names variable="author editor">
          <name form="short" delimiter="/" name-as-sort-order="all"/>
        </names>
      </else>
    </choose>
  </macro>
  <macro name="locator-with-label">
    <group delimiter=" ">
      <label variable="locator" form="symbol"/>
      <text variable="locator"/>
    </group>
  </macro>
  <macro name="autor-editor-note">
    <names variable="author" font-style="italic">
      <name form="short" delimiter="/" sort-separator=""/>
      <substitute>
        <names variable="editor"/>
      </substitute>
    </names>
  </macro>
  <macro name="author-chapter">
    <names variable="container-author">
      <name delimiter="/ " name-as-sort-order="all" sort-separator=", " form="short"/>
      <label form="short" prefix=" (" suffix=")"/>
    </names>
  </macro>
  <macro name="journalname-year">
    <group delimiter=" ">
      <text variable="container-title-short"/>
      <date date-parts="year" form="text" variable="issued"/>
    </group>
  </macro>
  <macro name="firstpage-locator">
    <text variable="page-first"/>
    <text variable="locator" prefix=" (" suffix=")"/>
  </macro>
  <macro name="edition">
    <choose>
      <if match="any" is-numeric="edition">
        <group delimiter=" ">
          <number vertical-align="baseline" suffix=" " variable="edition" form="ordinal"/>
          <text term="edition" form="short" suffix="."/>
          <date date-parts="year" form="text" variable="issued" prefix=" (" suffix=")"/>
        </group>
      </if>
      <else-if variable="edition">
        <text variable="edition" form="short"/>
        <date date-parts="year" form="text" variable="issued" prefix=" (" suffix=")"/>
      </else-if>
      <!-- display year without brackets if this is the first edition (aka variable edition is not set) -->
      <else>
        <date date-parts="year" form="text" variable="issued" prefix=" "/>
      </else>
    </choose>
  </macro>
  <citation et-al-min="5" et-al-use-first="1">
    <layout delimiter="; ">
      <choose>
        <!-- Journal article
             Style: <authors italic>, <journalname short> <journal-year>, <first-page>, <locator/cited page(s)>    
        -->
        <if type="article-journal">
          <group delimiter=", ">
            <text macro="author-note"/>
            <text macro="journalname-year"/>
            <text macro="firstpage-locator"/>
          </group>
        </if>
        <else-if type="article-newspaper">
          <text macro="author-note" suffix=", "/>
          <text variable="container-title"/>
          <date form="numeric" variable="issued" prefix=" v. "/>
          <text variable="URL" prefix=", "/>
        </else-if>
        <!-- Book
             Style: <authors italic>, <title short>, [<edition>. Aufl. ]<year>, <locator/cited page(s)>    
        -->
        <else-if type="book">
          <text macro="autor-editor-note" suffix=", "/>
          <choose>
            <if match="none" position="first">
              <group delimiter=" " prefix="(" suffix="), ">
                <text value="o. Fn."/>
                <text variable="first-reference-note-number"/>
              </group>
            </if>
            <else>
              <text variable="title" form="short" suffix=", "/>
              <text macro="edition"/>
            </else>
          </choose>
          <choose>
              <!-- "S." as a locator is ommited. Many books however are instead cited by § plus margin number. The § has to appear. -->
              <if locator="page">
                  <text variable="locator" prefix=", "/>
              </if>
              <else>
                  <label variable="locator" form="symbol" prefix=", "/>
                  <text variable="locator" prefix=" "/>
              </else>
          </choose>
        </else-if>
        <!-- Legal commentary or handbook should be of publication type "entry-encyclopedia"
        - The term "Bearbeiter" (author of a certain chapter) in the following examples should be added by you and is not governed by this stylesheet

        Style:
        - if container-title (=Zotero.encyclopediaTitle) is NOT set: <editor non-italic>, <title short>, [<edition>. Aufl. ]<year>, <locator/cited page(s)>
        -.- i.e. Bearbeiter, in: Taeger/Gabel, BDSG, 2. Aufl. 2013, ... (where you should add "Bearbeiter, in: " yourself)
        - else <container-title>, [<edition>. Aufl. ]<year>, <locator/cited page(s)>
        -.- i.e. Bearbeiter, in: BeckTKG, 4. Auflage 2013, ... (where you should add "Bearbeiter, in: " yourself)

        if there is at least one series-editor (CSL.collection-editor) set: <collection-editor>, [<edition>. Aufl. ]<year>, <locator/cited page(s)> 
        -.- i.e. Bearbeiter, in: Palandt, BGB, 73. Aufl. 2014, ... (where you should add "Bearbeiter, in: " yourself)
        -->
        <else-if type="entry-encyclopedia">
          <choose>
            <if variable="container-title">
              <text variable="container-title" suffix=", "/>
            </if>
            <else>
              <text macro="author-commentary" suffix=", "/>
              <choose>
                <if match="none" position="first">
                  <group delimiter=" " prefix="(" suffix="), ">
                    <text value="o. Fn."/>
                    <text variable="first-reference-note-number"/>
                  </group>
                </if>
                <else>
                  <text variable="title" suffix=", " form="short"/>
                </else>
              </choose>
            </else>
          </choose>
          <choose>
            <if match="any" position="first">
              <text macro="edition"/>
            </if>
          </choose>
          <text variable="locator" prefix=", "/>
        </else-if>
        <!-- Chapter
        Style: <author italic>, in: <book-author>, <title short>, [<edition>. Aufl.] <year>, <page> (<locator>)
        e.g.: Mantz in Spindler, Rechtliche Rahmenbedingungen von Open Access-Publikationen, 2006, 55 (57)
        -->
        <else-if type="chapter">
          <text macro="autor-editor-note" suffix=", in: "/>
          <text macro="author-chapter" suffix=", "/>
          <text variable="container-title" suffix=", "/>
          <text macro="edition"/>
          <text macro="firstpage-locator" prefix=", "/>
        </else-if>
        <!-- Legal case
        Style:
        if case is published in journal:  <court> <journal> <journal-year>, <first-page>, <locator> [ <en-dash> <case name>]
        otherwise:                        <court>, <type of decision> v. <dated-decided> <en-dash> <docketnumber> [ <en-dash> <case name>]   (type of decision is saved in field "note")
        -->
        <else-if type="legal_case" match="any">
          <choose>
            <!-- is the case published in a journal? -->
            <if variable="container-title">
              <text variable="authority" suffix=" "/>
              <text variable="container-title" form="short" suffix=" "/>
              <text variable="volume" suffix=", "/>
              <text macro="firstpage-locator"/>
            </if>
            <else>
              <text variable="authority" suffix=", "/>
              <text variable="genre" suffix=" v. "/>
              <date form="numeric" variable="issued" suffix=" &#8211; "/>
              <text variable="number"/>
            </else>
          </choose>
          <choose>
            <if variable="title-short">
              <text variable="title-short" prefix=" &#8211; "/>
            </if>
          </choose>
        </else-if>
        <else>
          <group delimiter=", ">
            <text macro="author-note"/>
            <text variable="title"/>
            <text macro="locator-with-label"/>
          </group>
        </else>
      </choose>
    </layout>
  </citation>
  <bibliography>
    <sort>
      <key macro="author"/>
      <key variable="issued"/>
    </sort>
    <layout>
      <choose>
        <if type="article-journal">
          <group delimiter=", ">
            <text macro="author-note"/>
            <text variable="title"/>
            <text macro="journalname-year"/>
            <text macro="firstpage-locator"/>
          </group>
        </if>
        <else-if type="book">
          <text macro="autor-editor-note" suffix=", "/>
          <text variable="title" form="short" suffix=", "/>
          <text macro="edition"/>
        </else-if>
        <else-if type="article-newspaper">
          <text macro="author-note" suffix=", "/>
          <text variable="title" suffix=", "/>
          <text variable="container-title"/>
          <date form="numeric" variable="issued" prefix=" v. "/>
          <text variable="URL" prefix=", "/>
        </else-if>
        <else-if type="entry-encyclopedia">
          <choose>
            <if variable="container-title">
              <text variable="container-title" suffix=", "/>
            </if>
            <else>
              <text macro="author-commentary" suffix=", "/>
              <text variable="title" suffix=", " form="short"/>
            </else>
          </choose>
          <text macro="edition"/>
        </else-if>
        <else-if type="chapter">
          <text macro="autor-editor-note" suffix=", in: "/>
          <text macro="author-chapter" suffix=", "/>
          <text variable="container-title" suffix=", "/>
          <text macro="edition"/>
          <text variable="page-first" prefix=", "/>
        </else-if>
      </choose>
    </layout>
  </bibliography>
</style>
Quintus commented 2 years ago

From the CSL 1.0.1 spec (emphasis mine):

Specifies whether all the name-parts of personal names should be displayed (value “long”, the default), or only the family name and the non-dropping-particle (value “short”)

andras-simonyi commented 2 years ago

Thanks for the report! I tried to reproduce the problem with non-dropping particles but it seems to be bib(la)tex specific, that is, using the corresponding CSL-JSON

[
  {
    "id": "vhellfeld1989alg",
    "type": "article-journal",
    "container-title": "Gewerblicher Rechtsschutz und Urheberrecht}",
    "page": "471-485",   
    "title": "Sind Algorithmen schutzfähig?",
    "author": [
      {
        "family": "Hellfeld",
        "given": "Alex",
        "non-dropping-particle": "von"
      }
    ],
    "issued": {
      "date-parts": [
        [
          "1989"
        ]
      ]
    }
  }
]

I seem to get the correct result. Could you confirm this? If that is the case then I will move on to look into the bib(la)tex name parser.

andras-simonyi commented 2 years ago

I've merged a PR which adds a configurable list of dropping particles (˙citeproc-bt-dropping-particles`) and classifies other particles as non-dropping. Hopefully this solves this particular problem.

Quintus commented 2 years ago

Thanks for coming back to me! I had a quite busy week and was not able to deal with this issue until today.

I seem to get the correct result. Could you confirm this?

I can confirm that it exports correctly with the CSL-JSON.

I've merged a PR which adds a configurable list of dropping particles (˙citeproc-bt-dropping-particles`) and classifies other particles as non-dropping. Hopefully this solves this particular problem.

Very nice, thank you. I can confirm that it now (05ee55c1ce0edd4bbfc9d60913dc15e7b7a45df4) exports properly as von Hellfeld with either input format.