Highlighting an author’s name for CV using IEEEtran

1 minute read

Highlighting a specific author’s name is useful and widely used in CV. But there is no elegant way to do it with existing latex packages. The IEEEtran.bst style does not provide this functionality neither. There are many ways hacking the latex to achieve the goal. Many of them are error-prone, only working for particular cases and not easy to understand.

Here is a solution that is relatively elegant, easy to understand and maintain. The main idea is to modify the bst file, match the specific author’s name and then highlight it. Thus, no modification need to be done to the bib file.

  1. add a highlight function to the IEEEtran.bst before FUNCTION {format.names}
    FUNCTION {highlight.if.cv.author}
    { duplicate$ purify$ "Y. Zhang" purify$ =
     { "\textbf{" swap$ * "}" * }
     'skip$
      if$
    }
    

    NOTE: The command is trying to compare the string. So you need to provide the Y. Zhang to the highlight function rather than Zhang, Yu in bibtex entry.

  2. call highlight.if.cv.author in FUNCTION {format.names} between format.name$ and bibinfo bibinfo.check as below
    FUNCTION {format.names}
    { 'bibinfo :=
      duplicate$ empty$ 'skip$ {
      this.to.prev.status
      this.status.std
      's :=
      "" 't :=
      #1 'nameptr :=
      s num.names$ 'numnames :=
      numnames 'namesleft :=
     { namesleft #0 > }
     { s nameptr
       name.format.string
       format.name$
       highlight.if.cv.author
       bibinfo bibinfo.check
       't :=
       nameptr #1 >
         { nameptr num.names.shown.with.forced.et.al #1 + =
           numnames max.num.names.before.forced.et.al >
           is.forced.et.al and and
             { "others" 't :=
               #1 'namesleft :=
             }
             { skip$ }
           if$
           namesleft #1 >
             { ", " * t do.name.latex.cmd * }
             { s nameptr "{ll}" format.name$ duplicate$ "others" =
                 { 't := }
                 { pop$ }
               if$
               t "others" =
                 { " " * bbl.etal emphasize * }
                 { numnames #2 >
                     { "," * }
                     { skip$ }
                   if$
                   bbl.and
                   space.word * t do.name.latex.cmd *
                 }
               if$
             }
           if$
         }
         { t do.name.latex.cmd }
       if$
       nameptr #1 + 'nameptr :=
       namesleft #1 - 'namesleft :=
     }
      while$
      cap.status.std
      } if$
    }
    
  3. test in your tex file.
    \documentclass{article}
    \begin{document}
    \nocite{*}
    \bibliographystyle{IEEEtran}
    \bibliography{your_reference}
    \end{document}
    

Tags:

Categories:

Updated: