4

I'm tring to update my CV by using a .bib instead of writing everything. For that, everything's fine. But, I'd also like to highlight my name in every entry in the bibliography. I am using plainrevyr.bst and already tried This and That

Basically, following those two posts, I've added these functions to my .bst

FUNCTION {cv.author}
{ "Doe, John" }


FUNCTION {highlight}
{ duplicate$ empty$
      { pop$ "" }
      { "\textbf{\textsc{" swap$ * "}}" * }
   if$
}


FUNCTION {highlight.cv.author}
{ duplicate$ purify$ cv.author purify$ =
    { highlight }
    'skip$
  if$
}

I've also added highlight.cv.author in the function format.names after format.name$ as required As I understand from the other examples I've found, my major issue comes from the function cv.author.

So, if I use :

FUNCTION {cv.author}
{ "Doe, John" } 

Nothing happens (I've also tried "John Doe" as it is how a name appear in the biblio)

If I try instead :

FUNCTION {cv.author}
{ "Doe, John" nameptr  "{ff~}{vv~}{ll}{, jj}"  format.name$ }

I got a error saying that John Doe is a string literal, not an integer. I agree with this error as nameptr is defined as an integer.

Here is format.names :

INTEGERS { nameptr namesleft numnames }
FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr "{ff~}{vv~}{ll}{, jj}" 
    format.name$ 
    highlight.cv.author 't :=
      nameptr #1 >
        { namesleft #1 >
            { ", " * t * }
            { numnames #2 >
                { "," * }
                'skip$
              if$
              t "others" =
                { " et~al." * }
                { " and " * t * }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

How to make it work ?

Thank you !


EDIT

Here is how I call my biblio :

\documentclass{cv2}

\usepackage[francais]{babel} 
\usepackage[T1]{fontenc}       %% Pour la césure des mots accentués
\usepackage[utf8]{inputenc}  %% les accents dans le fichier.tex
\usepackage{fullpage}
\usepackage[backref]{hyperref} 

\begin{document}

\bibliographystyle{plainrevyr}
\nocite{*}
\bibliography{MyPapers}

\end{document}

And 2 Bibentries :

@article{Doe2014,
    title = {{First title}},
    year = {2014},
    journal = {Phys. Chem. Chem. Phys.},
    author = {Name1, Forename1 and Doe, John and Name2, Forename2 and Name3, Forename3},
    number = {40},
    pages = {22903--22912},
    volume = {16},
    url = {http://dx.doi.org/10.1038/C4CP03276D http://xlink.rsc.org/?DOI=C4CP03276D},
    doi = {10.1038/C4CP03276D},
    issn = {1462-9076}
}

@article{Doe2012,
    title = {{MyTitle2}},
    year = {2012},
    journal = {Journal of Physical Chemistry C},
    author = {Doe, John and Name4, Forename4 and Name2, Forename2 and Name5, Forename5 and Name1, Forename1},
    number = {25},
    pages = {13716--13724},
    volume = {110},
    isbn = {1932-7447},
    doi = {10.1021/jp304525f},
    issn = {19327457}
}

And Here the links to cv2 and plainrevyr

  • I see your highlight definition contains \textbf{\textsc{" swap$ * "}}. It is possible that your font does not support bold small caps. You could check that to be the case by temporarily changing the \textsc to \textrm. If that produced bold roman text, then the issue is one of your font not supporting bold small caps. – Steven B. Segletes Apr 11 '18 at 15:13
  • 1
    Thank you for your answer. I've thought about that and also tried to remove the \textsc to only have \textbf{" swap$ * "} with no more success. I tried to replace \textsc by \textrmas you suggested to test too, but no luck either. – Natantye Apr 11 '18 at 15:24
  • ...and you deleted the .bbl file (or something equivalent) after you made that change to the .bst file, so as to force a bibliography recompilation? – Steven B. Segletes Apr 11 '18 at 15:26
  • 1
    Yes ! I did indeed. – Natantye Apr 11 '18 at 15:27
  • 1
    Welcome to TeX.SE! Can you please add an short compilable code showing how you build the bibliography. Do not forget to add two bib entrys to your question. And please give us a link to your changed bst file ... – Mensch Apr 11 '18 at 15:56
  • Thank you. As requested, I edited my post to add everything you asked (I hope). – Natantye Apr 12 '18 at 08:07

1 Answers1

4

The name has to be specified in the right format. When I use

FUNCTION {cv.author}
{ "John Doe" }

it actually works fine, but it is more reliable to use format.name$: Replace the function cv.author by

FUNCTION {cv.author}
{ "Doe, John" #1 "{ff~}{vv~}{ll}{, jj}"  format.name$ }

The difference to your attempt is the #1 instead of nameptr. This parameter defines which name to use, if multiple names (separated with and) appear in the first parameter. "Doe, John" only contains one name, so every other parameter then #1 will lead to an error. Your specific error was caused because cv.author was called while nameptr had no value assigned at all.

  • I've tried with "John Doe" as you wrote it, and it didn't work neither. Maybe I missed something when I compiled. Your last solution is working perfectly ! Thank you so much ! – Natantye Apr 12 '18 at 09:36