缩写自己的名字

缩写自己的名字

我正在使用\usepackage[backend=biber, style=authoryear]{biblatex},但我希望我的名字显示为破折号,或者更好的是显示我姓氏的首字母。也就是说,我希望看到(-, Leibniz and Newton 1661)(C., Leibniz and Newton 1661)内联。我很高兴在最后的参考资料部分有完整版本。有办法吗?

答案1

Biber 0.9.4/biblatex 1.6 现已发布,现在这应该可以实现,因为现在每个名称都有一个名称哈希,而且整个名称列表都有一个哈希。请参阅 biblatex 1.6 手册第 4.2.4.1 节中的“哈希”字段。

类似这样的方法似乎有效。使用注释行而不是紧接着注释行的行,以使用破折号代替首字母。

\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}

答案2

使用该shortauthor字段。

\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}

答案3

您可以为您的姓名定义一个宏,并将其放在 bib 文件中。在序言中,可以使用 来定义此宏,\newcommand{\myname}{--}以添加破折号代替您的姓名。要获得参考列表的不同结果,您需要在插入列表之前重新定义宏,例如使用\renewcommand{\myname}{Raphael Clifford}。但是,Bib(La)TeX 无法将您的姓名解析为姓和名,因此您无法获得自动格式化,而需要手动将其以所需格式存储在宏中。

相关内容