1

I think this i similar to Only author's initials in BibTeX natbib using named style or Abbreviated first names without spaces in between?

When an author has multiple first names, I need to have the initials of these names with no space or tilde in between. E.g.: author="Gamboz, A. B." to A.B. Gamboz

The format "{f{.}. }{vv~}{ll}{, jj}" does it, however it also removes the "-" that can be present in some French names or Japanese and Chinese transliterations.

E.g.: author="Jean-Baptiste Poquelin" to J.B. Poquelin (instead of J.-B. Poquelin).

Is there a way to preserve the "-"?

MWE (from pg.37 of "Tame the BeaST"):

min.bst

ENTRY {any}{}{}
FUNCTION {test}
{"Jean-Baptiste Poquelin"
#1 "{f{.}.~}{vv~}{ll}{, jj}" format.name$ top$}
READ
EXECUTE{test}

min.aux

\bibstyle{min}

then run bibtex min

1 Answer 1

0

I've found an answer to this in BibTeX Frequently Asked Questions Q.35 proposed by Philip G. Ratcliffe on the newsgroup comp.text.tex on June 28, 2002 in the thread BiBTeX, bst hackers, format.name$, please help which consists in using a function to "manually" remove spaces

STRINGS {z}

FUNCTION {remove.spaces}
{ 'z :=
  ""
  { z empty$ not }
  { z #1 #1 substring$
    z #2 global.max$ substring$ 'z :=
    duplicate$ "~" =
      'pop$
      { duplicate$ " " =
          'pop$
          { * }
        if$
      }
    if$
  }
  while$
}

INTEGERS { nameptr namesleft numnames }

FUNCTION {forname.format.string}
{ "{f.}" }

FUNCTION {surname.format.string}
{ "{vv~}{ll}" }

FUNCTION {jnrname.format.string}
{ "{, jj}" }

FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr forname.format.string format.name$ remove.spaces
      duplicate$ empty$ 'skip$ { "~" * } if$
      s nameptr surname.format.string format.name$ *
      s nameptr jnrname.format.string format.name$ *
      't :=

However, this solution will break if one has authors with accents written in the following form:

  author = {Greensite, Jeff and Olejn\'ik, {\v S}tefan and Zwanziger, Daniel},

because the space in {\v S} will be lost:

J.~Greensite, {\vS}.~Olejn\'ik and D.~Zwanziger
7
  • It should be {\v{S}}tefan
    – egreg
    Jul 2, 2020 at 15:09
  • You mean in the "author" field of the bibtex record? I fully agree. However in my use case I had to take the info as it come from the internet (i.e. no control on the source), so I thought I'd mention this corner case. E.g. curl -H 'Accept: application/x-bibtex' https://inspirehep.net/api/literature/1516023. I've asked INSPIRE to change the accent to \v{S}. Is the external group important here? Jul 3, 2020 at 16:20
  • It's more important for surnames, because the missing braces will impact on sorting. About the link you show, I find it very “unusual” that one name is reported as Rap\v cák instead of the “correct” Rap{\v{c}}{\'{a}}k. Also bracing titles is wrong.
    – egreg
    Jul 3, 2020 at 16:23
  • They usually do a very good job, but have some sporadic case of bad metadata. I'll report your observations, thanks. Jul 3, 2020 at 16:29
  • 1
    @egreg I'm guessing the Rap\v cák is a relic of software written during the era of 8-bit encodings. This is especially problematic for data stored in databases where until sometime around 2008 or so it was not uncommon for the default encoding for data storage to be ISO-8859-1 which includes á but not č,
    – Don Hosek
    Jul 27, 2021 at 21:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .