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 am using \usepackage[backend=biber, style=authoryear]{biblatex} but I would like my name to appear as a dash or even better would be the first initial of my surname. That is I would like to see (-, Leibniz and Newton 1661) or (C., Leibniz and Newton 1661) inline. I am happy to have the full version in the references section at the end. Is there a way to do this?

share|improve this question
1  
Could you not just use a copy of your .bib file where you search&replace'd your name with -- or maybe some macro? –  Martin Scharrer Jul 2 '11 at 14:59
    
Yes and I think the macro solution may be the simplest all round in the end. –  Raphael Jul 2 '11 at 15:33
    
Oh actually that's not quite so obvious as you don't want the abbreviated version in the references at the end. –  Raphael Jul 2 '11 at 15:57
    
Then simply change the macro before the reference list. –  Martin Scharrer Jul 2 '11 at 17:04
2  
Simply put \newcommand{\myname}{--} in the preamble and \renewcommand{\myname}{Raphael Clifford} direct before the reference list. –  Martin Scharrer Jul 2 '11 at 17:29
show 1 more comment

3 Answers

up vote 12 down vote accepted

Biber 0.9.4/biblatex 1.6 are now released and this should now be possible as every single name has a name hash now, in addition to the name list as a whole having a hash. See the field "hash" in section 4.2.4.1 of the biblatex 1.6 manual.

Something like this seems to work. Use the commented lines instead of those immediately below them to use a dash instead of initials.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber,style=authoryear]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{test1,
  AUTHOR      = {Raphael Clifford and John Doe},
  TITLE       = {Eliding My Self},
  PUBLISHER   = {Publisher},
  LOCATION    = {Elidington},
  YEAR        = {1968},
}
@BOOK{test2,
  AUTHOR      = {Brian Blinkers and Cecil Crenshaw and Raphael Clifford},
  TITLE       = {Eliding My Self Again},
  PUBLISHER   = {Publisher},
  LOCATION    = {Elidington},
  YEAR        = {1969},
}
@BOOK{test3,
  AUTHOR      = {Brian Blinkers and Raphael Clifford and Cecil Crenshaw},
  TITLE       = {Eliding My Self Once More},
  PUBLISHER   = {Publisher},
  LOCATION    = {Elidington},
  YEAR        = {1970},
}
\end{filecontents}
\addbibresource{test.bib}

\newbibmacro*{name:me}[1]{%
  \usebibmacro{name:delim}{#1}%
  \usebibmacro{name:hook}{#1}%
  \mkbibnamelast{#1}}%

\DeclareNameFormat{labelname}{%
  \iffieldequals{hash}{\mehash}%
%    {\usebibmacro{name:me}{\bibrangedash}}%
    {\usebibmacro{name:me}{#2}}%
    {\ifboolexpr{ test {\ifstrequal{#1}{Clifford}} and test {\ifstrequal{#3}{Raphael}}}
%      {\savefield{hash}{\mehash}\usebibmacro{name:me}{\bibrangedash}}%
      {\savefield{hash}{\mehash}\usebibmacro{name:me}{#2}}%
      {\ifcase\value{uniquename}%
         \usebibmacro{name:last}{#1}{#3}{#5}{#7}%
       \or
         \ifuseprefix
           {\usebibmacro{name:first-last}{#1}{#4}{#5}{#8}}
           {\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}}%
       \or
         \usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
       \fi
       \usebibmacro{name:andothers}}}}%

\begin{document}
\cite{test1}\\
\cite{test2}\\
\cite{test3}
\printbibliography
\end{document}
share|improve this answer
    
That's very interesting, thanks. –  Raphael Jul 4 '11 at 21:28
    
biblatex 1.6/biber 0.9.4 will be released shortly. In addition to a name list having a unique hash as is currently the case, every individual name in a name list will also have a unique hash which can be used to perform such tests as are required here. –  PLK Jul 24 '11 at 16:56
    
Thanks! Now Biber 0.9.4/biblatex 1.6 are out, would you be able to add an example of how to solve the problem using them to your answer? –  Raphael Aug 1 '11 at 14:33
add comment

Use the shortauthor field.

\documentclass{article}

\usepackage[style=authoryear]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{C11,
  author = {Clifford, Raphael},
  shortauthor = {{---}},
  year = {2011},
  title = {How to change one's own name to a dash},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

Some text \autocite{C11}.

\printbibliography

\end{document}
share|improve this answer
    
How have you specified that the short form should be used? –  Raphael Jul 2 '11 at 13:50
    
shortauthor will always be used in citations if the field is defined. –  lockstep Jul 2 '11 at 13:57
    
Ah OK. I think this means two things. First that I need to write a program to go through my bib file and take every author line and add a duplicate shortauthor line just after it with my name changed to its abbreviated form. Second, it's going to be hard to share a bib file with lots of people after doing that and all be able to use the shorthand only for their own names when they write papers. Maybe there is nothing that can be done about this. I can imagine a hack where all author names are macros but this seems rather ugly, to say the least. –  Raphael Jul 2 '11 at 14:01
    
My solution wasn't meant for "shared" .bib files. It may be possible to come up with a bib-independent solution, but I can't promise anything. –  lockstep Jul 2 '11 at 14:04
    
BTW, should your name also be replaced with a dash if you're one of the authors of a multi-author-work? (This would make a bib-independent solution harder.) –  lockstep Jul 2 '11 at 14:13
show 1 more comment

You can define a macro for your name and place this in the bib-file. In the preamble this macro could be defined using \newcommand{\myname}{--} to add a dash instead of your name. To get a different result for the reference list you need to redefine the macro just before the list is insert, e.g. using \renewcommand{\myname}{Raphael Clifford}. However, Bib(La)TeX is then not able to parse your name into first and last name, so you won't get automatic formatting for it, but manually need to store it in the macro in the required form.

share|improve this answer
    
Thanks. As you say, the problem with not being able to parse the name makes it a bit of a hack in the end. Hopefully 0.9.4 will make things easier as mentioned by PLK. –  Raphael Jul 4 '11 at 21:30
add comment

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.