3

As quite often the surnames in .bib are all in capital letters, such as VICTORIA, but most journals do not want surnames all in capitals, so it is useful to let .bst be able to "t" change.case$ the surnames, to get Victoria in the reference.

I can do so for one .bst, with the code like

 t #1 "{vv~}{ll}" format.name$ 
       uppercase.name
           {  "t" change.case$ }
           'skip$ 
       if$
 t #1 "{~f{~}}" format.name$ *
 t #1 "{, jj}" format.name$ *

but cannot make it work for model6-num-names.bst which is available from Elsevier zip

The main part I tried is to change from:

nameptr #1 >
    {
      namesleft #1 >
        { ", " * t * }
        {
          "," *
          s nameptr "{ll}" format.name$ duplicate$ "others" =
            { 't := }
            { pop$ }
          if$
          t "others" =
            {
              " " * bbl.etal *
            }
            { " " * t * }
          if$
        }
      if$
    }
    't
  if$

to:

nameptr #1 >
    {
      namesleft #1 >
        { ", " * t #1 "{vv~}{ll}" format.name$ 
                    "t" change.case$ 
            t #1 "{~f{~}}" format.name$ *
            t #1 "{, jj}" format.name$ * }
        {
          "," *
          s nameptr "{ll}" format.name$ duplicate$ "others" =
            { 't := }
            { pop$ }
          if$
          t "others" =
            {
              " " * bbl.etal *
            }
            { " " * t #1 "{vv~}{ll}" format.name$ 
                        "t" change.case$ 
                    t #1 "{~f{~}}" format.name$ *
                    t #1 "{, jj}" format.name$ * }
          if$
        }
      if$
    }
    't
  if$

As model6-num-names.bst does not need the 'uppercase.name' function, so the 'uppercase.name' if$ part is reduced to "t" change.case$ only.

The .bib is:

@article{srarticle1p, author = {JEREMY, George and MICHAEL, JACKSON}, title = {The art of writing }, journal = {Software Engineering}, year = {2018}, month = {}, volume = {19}, number = {345}, pages = {1234}, doi = {}, }    @book{Strunk2000, author = {VICTORIA, Water and WHITE, Edison}, title = {The elements of style}, edition = {4th}, editor = {}, translator = {}, address = {New York}, publisher = {Longman}, year = {2000}, month = {}, volume = {}, number = {}, pages = {}, isbn = {}, doi = {}, }

But the surnames are still all in capitals:

surnames still all in capital letters

I have tried to place the "t" change.case$ around the .bst, but still no joy.

Could our experts show the right way to only keep the first letter of surnames in capitals, and lowercase other letters even if in .bib the surname letters are all in capitals? "t" change.case$ the surnames?

3

model6-num-names.bst calls format.names$ in several places. Furthermore, some uses of format.names$ are not actually used to print the name in the output (this is the case for the bit you showed as modified in the question: the code there does "et al." handling, but does not print the names).

We need to modify uses in

  • FUNCTION {format.names}
  • FUNCTION {format.full.names}
  • FUNCTION {format.lab.names}

It is slightly more convenient to show the necessary changes in a diff rather than describing them with many words

--- model6-num-names.bst    2019-11-09 12:11:53.818725800 +0100
+++ model6-num-names-nocap.bst  2019-11-09 12:08:38.767078500 +0100
@@ -1,3 +1,12 @@
+%%%% `model6-num-names-nocap.bst'
+%%%% for https://tex.stackexchange.com/q/515600/35864
+%%%% 2019-11-09 MW
+%%%% adds `"t" change.case$` after almost all format.names$ calls
+%%%% to convert names from all uppercase to title case
+%%%%
+%%%% Original copyright header follows
+%%%% (distributed under LPPL 1.3c)
+%%%%
 %%
 %% This is file `model6-num-names.bst'  (Version 2.0),
 %% 
@@ -428,9 +437,11 @@
   s num.names$ 'numnames :=
   numnames 'namesleft :=
     { namesleft #0 > }
-    { s nameptr
-      "{vv~}{ll}{ jj}\xfnm[{ f{.}.}]"
-      format.name$
+    { s nameptr "{vv~}" format.name$ "t" change.case$
+      s nameptr "{ll}" format.name$ "t" change.case$
+      *
+      s nameptr "{ jj}\xfnm[{ f{.}.}]" format.name$
+      *
 %      remove.dots
       bibinfo bibinfo.check
       't :=
@@ -541,8 +552,9 @@
   s num.names$ 'numnames :=
   numnames 'namesleft :=
     { namesleft #0 > }
-    { s nameptr
-      "{vv~}{ll}" format.name$
+    { s nameptr "{vv~}" format.name$ "t" change.case$
+      s nameptr "{ll}" format.name$ "t" change.case$
+      *
       't :=
       nameptr #1 >
         {
@@ -1380,7 +1392,9 @@
 FUNCTION {format.lab.names}
 { 's :=
   "" 't :=
-  s #1 "{vv~}{ll}" format.name$
+  s #1 "{vv~}" format.name$ "t" change.case$
+  s #1 "{ll}" format.name$ "t" change.case$
+  *
   s num.names$ duplicate$
   #2 >
     { pop$
@@ -1392,7 +1406,11 @@
             {
               " " * bbl.etal *
             }
-            { bbl.and space.word * s #2 "{vv~}{ll}" format.name$
+            { bbl.and space.word
+              *
+              s #2 "{vv~}" format.name$ "t" change.case$
+              s #2 "{ll}" format.name$ "t" change.case$
+              *
               * }
           if$
         }

You can download the modified file at https://gist.github.com/moewew/a79d76d88fe0604ec428326865c22cc5, that site also shows a nice diff in the revisions tab if you are interested.

Note that I split up the calls with "{vv~}{ll}" into to separate calls to make sure that names with a von part are not unnecessarily de-capitalised.


I should mention that I strongly recommend inputting names in the .bib file in an uncapitalised way. It is much easier for BibTeX to turn names in all caps if necessary (and I really hope that is necessary only very rarely because ALL CAPS names don't look very nice) than to handle ALL CAPS names in the input.

3
  • Wonderful answer! thanks, Moewe! I only changed in the format.names section, which is enough for it to work, without changing full.names and lab.names. I see there are editor format.full.names and I put all-capital surnames in editors to test whether it will "t" change.case$ editors without changing full.name section, it still works. Same for lab.names, your method works without changing it. Though I wonder what the full.names and lab.names affect. Thanks again! – miya Nov 10 '19 at 13:43
  • 1
    @miya I tracked down the uses of one of the other two (I forget which one) and found that it was responsible for formatting the author names for use with natbib's \citet/\citeauthor feature. – moewe Nov 10 '19 at 14:04
  • Yes I tested using \citet and \citeauthor to check which part is affecting the citation text, and found that if I do not change the code in lab.names as you provided, the surnames are all capitals. And looks like the "t" change.case$ in full.names does not affect in this case. But this does not matter, it is already beyond consideration. Thanks @moewe again! – miya Nov 16 '19 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.