Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm preparing my CV in latex using a slightly modified template with respect to the one found here http://robjhyndman.com/research/cv.sty. I like it very much, in particular the fact that bibliography can be splitter in several type of contribution. I've have also applied the trick described here Underline my name in the bibliography by Andrzej. The problem is that the first author in the bibliography is formatted differently from the others, as Surname, Initial, SecondAuthorInitial Surname. So that the trick applied to underline my name do not applied to all the entries where I'm the first author. I would like to change the way the first author appear in order to be compliant with the other. So in this way I think that the trick for the underlying should work.

As asked I post the code relating to the bibliography setting

\documentclass[a4paper,11pt]{article}
\usepackage[sorting=ynt,bibstyle=authoryear-comp,labelyear=false,labelyear=false,defernumbers=true,maxnames=100,uniquename=init,backend=bibtex8,dashed=false,arxiv=abs]{biblatex}
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat[article]{pages}{#1}
\DeclareFieldFormat[inproceedings]{pages}{\lowercase{pp.}#1}
\DeclareFieldFormat[incollection]{pages}{\lowercase{pp.}#1}
\DeclareFieldFormat[article]{volume}{\textbf{#1}}
\DeclareFieldFormat[article]{number}{(#1)}
\DeclareFieldFormat[article]{title}{\MakeCapital{#1}}
\DeclareFieldFormat[inproceedings]{title}{#1}
\DeclareFieldFormat{shorthandwidth}{#1}
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor}%
\setunit{\labelnamepunct}\newblock
\MakeSentenceCase{\usebibmacro{title}}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{version}%
\newunit\newblock
%  \usebibmacro{in:}%
\usebibmacro{journal+issuetitle}%
\newunit\newblock
\printfield{note}%
\setunit{\bibpagespunct}%
\printfield{pages}
\newunit\newblock
\printfield{issn}%
\newunit\newblock
\printfield{doi}%
\newunit\newblock
\usebibmacro{eprint}
%\newunit\newblock
%\usebibmacro{url+urldate}%
\newunit\newblock
\printfield{addendum}%
\newunit\newblock
\usebibmacro{pageref}%
\usebibmacro{finentry}}

% Remove dot between volume and number in journal articles.
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
 \printfield{series}%
 \setunit{\addspace}}%
 \printfield{volume}%
 %\setunit*{\adddot}%
 \printfield{number}%
 \setunit{\addcomma\space}%
 \printfield{eid}%
 \setunit{\addspace}%
 \usebibmacro{issue+date}%
 \newunit\newblock
 \usebibmacro{issue}%
 \newunit}


 %added a trick to underline my surname
\renewbibmacro*{name:first-last}[4]{%
\usebibmacro{name:delim}{#2#3#1}%
\usebibmacro{name:hook}{#2#3#1}%
\ifthenelse{\equal{#1}{Vianello}}% matches last name against YourLastName
{
  \uline{% wrapped with \uline
  \ifblank{#2}{}{\mkbibnamefirst{#2}\isdot\bibnamedelimd}%
  \ifblank{#3}{}{%
    \mkbibnameprefix{#3}\isdot%
    \ifpunctmark{'}%
      {}%
      {\ifuseprefix{\bibnamedelimc}{\bibnamedelimd}}}%
  \mkbibnamelast{#1}\isdot%
  \ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}}}%
{% original
  \ifblank{#2}{}{\mkbibnamefirst{#2}\isdot\bibnamedelimd}%
  \ifblank{#3}{}{%
    \mkbibnameprefix{#3}\isdot%
    \ifpunctmark{'}%
      {}%
      {\ifuseprefix{\bibnamedelimc}{\bibnamedelimd}}}%
  \mkbibnamelast{#1}\isdot%
  \ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}}}
  \usepackage{filecontents}

  \begin{filecontents}{biblio.bib}
   @article{PhysRevLett.106.125002,
   author = {Vianello, Nicola and Naulin, V and Schrittwieser, R and M uller, H. W. and    Zuin, M and Ionita, C and Rasmussen, J J and Mehlmann, F and Rohde, V and Cavazzana, R and Maraschek, M},
   title = {{Direct Observation of Current in Type-I Edge-Localized-Mode Filaments on the     ASDEX Upgrade Tokamak}},
   journal = {Physical Review Letters},
   year = {2011},
   volume = {106},
   number = {12},
   pages = {125002},
   month = mar
   }
  \end{filecontents}

  \addbibresource{biblio.bib}
  \begin{document}
  \nocite{*}
  \printbibliography
  \end{document}

Now I think the example should work once one provide a biblio.bib file (any bibliographic file you have should work. The only trick is the surname you chose, mine being Vianello) I apologize for the problems in the example provide

share|improve this question
    
Please give us a minimal working example so that we may see what's going on. –  qubyte Nov 8 '11 at 14:51
    
The problem is that your question requires us to follow links and hunt around to see what you mean. If you can place some minimal code that compiles, and shows the problem, in your question (indented so that it appears as LaTeX), then you'll get lots of responses quickly. As it is, it's too much hassle and most won't bother. –  qubyte Nov 8 '11 at 14:57
    
MWE ← here the link to meta with informations about MWE. –  Schweinebacke Nov 8 '11 at 15:01
    
Code is still not working, e.g. class is missing and it will not typeset anything without \begin{document}…\end{document} (please replace … by an example). You may use filecontents environment to add an example bib file. –  Schweinebacke Nov 8 '11 at 15:07

2 Answers 2

up vote 10 down vote accepted

To manipulate the output of the names you have to set sortname in the correct way.

\DeclareNameAlias{sortname}{last-first}

In this case the first name beside the first author is printed as initial.

To modify this you have to define your own formatting directives via \DeclareNameFormat.

A simple example is given by the definition of last-first (see biblatex.def):

\DeclareNameFormat{last-first}{%
  \iffirstinits
    {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
    {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
  \usebibmacro{name:andothers}}

The arguments have the following meaning:

% #1 = last name
% #2 = last name (initials)
% #3 = first name
% #4 = first name (initials)
% #5 = name prefix, a.k.a. 'von part'
% #6 = name prefix (initials)
% #7 = name affix, a.k.a. 'junior part'
% #8 = name affix (initials)

In this case you can format the name lists.

If you want to handle the first author in a special way you can use the test

\ifnumequal{\value{listcount}}{1}
  {ONLY FIRST AUHTOR}
  {ALL OTHER AUTHORS}

For example If you want to underline the first author of the list and the name list is formated as last name, first name (initials) you can do:

\usepackage[normalem]{ulem}

\DeclareFieldFormat{FirstAuthor}{\uline{#1}}

\DeclareNameFormat{last-first-underline}{%
    \ifnumequal{\value{listcount}}{1}
      {
       {\printtext[FirstAuthor]{\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}}
      }%
      {
       {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
      }%
      \usebibmacro{name:andothers}}
share|improve this answer
    
Thanks I was just posting exactly this solution. Together with the keyword firstinits=true in calling bib latex it solved my problem. Thank you in any case –  Nicola Vianello Nov 8 '11 at 16:08
    
@NicolaVianello: I thought you want to underline the first author. -- Sorry is spam. –  Marco Daniel Nov 8 '11 at 16:23

As far as I remember the behaviour how names show up in the bibliography can be modified with

\DeclareNameFormat{labelname}{%
   \ifuseprefix
     {\usebibmacro{name:last-first}{#1}{#4}{#5}{#8}}
     {\usebibmacro{name:last-first}{#1}{#4}{#6}{#8}}%
   \usebibmacro{name:andothers}}

This should always output Lastname Inital (last name= #1. initial= #4)

share|improve this answer
    
I'm a bit confused. I've stated the maxentry=100 in order to have all the authors cited for each entry (useful in a CV). So I think that in your post I should skip the \usebibmacro{name:andothers}. Or I'm missing something? –  Nicola Vianello Nov 8 '11 at 15:42
    
All this redefinition does is to print out all authors in the format Lastname Initial, e.g. Bush G., Obama B. and not G. Bush, Obama B. as it is now. My understanding was that the different treatment of the first author was messing up your underline-code. Anyway, you have a working version now... –  Martin H Nov 8 '11 at 16:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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