修改书目项目以使用别名

修改书目项目以使用别名

我定义了以下宏:

\newcommand{\cmdAlias}[2]{\defcitealias{#1}{#2}\citetalias{#1} \citep{#1}}

我可以修改.bib文件以便从参考书目中自动检索别名吗(而不是运行\cmdAlias{author:year}{AuthorFirstName AuthorLastName}:)例如,如何修改以下参考文献以包含它的别名,例如添加键alias

@article{dasi2007vorticity,
  alias = {Dasi {\it et. al}}
  title={Vorticity dynamics of a bileaflet mechanical heart valve in an axisymmetric aorta},
  author={Dasi, LP and Ge, L and Simon, HA and Sotiropoulos, F and Yoganathan, AP},
  journal={Physics of Fluids},
  volume={19},
  pages={067105},
  year={2007}
}

答案1

\documentclass{article}
\usepackage[square,numbers]{natbib}
\usepackage{hyperref}

\newcommand{\citeAlias}[1]{\defcitealias{#1}{\citeauthor{#1}}\citetalias{#1} \citep{#1}}
\newcommand{\citeAliasTwo}[2]{\defcitealias{#1}{#2}\citetalias{#1} \citep{#1}}

\begin{document}


A reference with one author: \citeAlias{knuth:1974}. It is also possible to manually define the alias name: \citeAliasTwo{knuth:1974}{Donald E. Knuth}.

A reference with more than one author: \citeAlias{dasi2007vorticity}. 

\bibliographystyle{plainnat}

\bibliography{mybib}

\end{document}

以下为 的内容mybib.bib

@ARTICLE{knuth:1974,
  author = {Knuth, Donald E.},
  title = {{C}omputer {P}rogramming as an {A}rt},
  journal = {Communications of the ACM},
  year = {1974},
  volume = {17},
  pages = {667--673},
  number = {12},
  month = {December },
  address = {New York, NY, USA},
  publisher = {ACM Press}
}

@article{dasi2007vorticity,
  title={Vorticity dynamics of a bileaflet mechanical heart valve in an axisymmetric aorta},
  author={Dasi, LP and Ge, L and Simon, HA and Sotiropoulos, F and Yoganathan, AP},
  journal={Physics of Fluids},
  volume={19},
  pages={067105},
  year={2007}
}

该文件的结果如下:

在此处输入图片描述

答案2

biblatex很简单:

\documentclass[12pt]{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTICLE{knuth:1974,
  author = {Knuth, Donald E.},
  title = {{C}omputer {P}rogramming as an {A}rt},
  journal = {Communications of the ACM},
  year = {1974},
  volume = {17},
  pages = {667--673},
  number = {12},
  month = {December },
  address = {New York, NY, USA},
  publisher = {ACM Press}
}
\end{filecontents}

\usepackage{biblatex}
\addbibresource{\jobname.bib}

% from biblatex.def
\DeclareCiteCommand{\citeauthor}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   \printtext[bibhyperref]{\printnames{labelname}}} % <-- this line changed
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citefullauthor}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \DeclareNameAlias{labelname}{first-last}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   \printtext[bibhyperref]{\printnames{labelname}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\newcommand\citealiasfull[2]{\citefullauthor{#1} \cite{#1}}
\newcommand\citealiasshort[2]{\citeauthor{#1} \cite{#1}}

\usepackage{hyperref}

\begin{document}

A macro with one parameter that provides the citation
and the author's name: \citealiasshort{knuth:1974}.
\citealiasfull{knuth:1974}

\printbibliography

\end{document}

答案3

以下是我尝试实现的示例。我想定义一个只有一个输入的宏,并且能够生成超链接的别名和参考编号。

\documentclass{article}
\usepackage[square,numbers]{natbib}
\usepackage{hyperref}

\newcommand{\citeAliasOne}[1]{\defcitealias{#1}\citetalias{#1} \citep{#1}}}
\newcommand{\citeAliasTwo}[2]{\defcitealias{#1}{#2}\citetalias{#1} \citep{#1}}

\begin{document}

Here, both the alias name and the reference number are hyper-linked:
\citeAliasTwo{knuth:1974}{Donald E. Knuth}.


Here, I am trying to only use one parameter to the macro and be able to mimic the
result of the macro {\tt citeAliasTwo}. Unfortunately, the result of {\tt citeAliasOne} 
is: \citeAliasOne{knuth:1974}, which is not what I want. In fact, I want to define a 
macro which gets one input and outputs both the alias name and the reference number 
hyper-linked. However, {\tt citeAliasOne} fails for this task.

\bibliographystyle{plainnat}

\bibliography{mybib}

\end{document}

以下是mybib的内容:

@ARTICLE{knuth:1974,
  author = {Knuth, Donald E.},
  title = {{C}omputer {P}rogramming as an {A}rt},
  journal = {Communications of the ACM},
  year = {1974},
  volume = {17},
  pages = {667--673},
  number = {12},
  month = {December },
  address = {New York, NY, USA},
  publisher = {ACM Press}
}

结果如下:

在此处输入图片描述

相关内容