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?
3 Answers
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}
- 757,742
- 22,776
-
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
-
2Thanks! 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? – Simd Aug 01 '11 at 14:33
-
This used to work but no longer compiles, probably because of the reasons outlined here. I'm having more success with this approach although it seems to add formatting issues with the commas in citations. – a3nm Dec 01 '16 at 00:42
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}
- 250,273
-
-
shortauthorwill always be used in citations if the field is defined. – lockstep Jul 02 '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. – Simd Jul 02 '11 at 14:01
-
My solution wasn't meant for "shared"
.bibfiles. It may be possible to come up with a bib-independent solution, but I can't promise anything. – lockstep Jul 02 '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 02 '11 at 14:13
-
Yes this was my intention and it's also the thing that makes re-editing my bib file more awkward. My (vain) hope was that you could have a long and short version of any number of authors and specify when you want to use the short version. – Simd Jul 02 '11 at 14:18
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.
- 262,582
-
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. – Simd Jul 04 '11 at 21:30
.bibfile where you search&replace'd your name with--or maybe some macro? – Martin Scharrer Jul 02 '11 at 14:59\newcommand{\myname}{--}in the preamble and\renewcommand{\myname}{Raphael Clifford}direct before the reference list. – Martin Scharrer Jul 02 '11 at 17:29