如何将引用关键字添加到参考书目中?
我们以此条目为例:
@book{Fowler1999,
address = {Boston, MA, USA},
author = {Fowler, Martin},
description = {AOEvolutionchapter short paper},
isbn = {0-201-48567-2},
publisher = {Addison-Wesley},
title = {Refactoring: Improving the Design of Existing Code},
year = 1999
}
我现在希望 PDF 文档中的参考书目如下所示:
[Fowler1999]马丁·福勒。重构:改进现有代码的设计. Addison-Wesley,美国马萨诸塞州波士顿,1999 年。ISBN 0-201-48567-2。
有人能帮我吗?我正在使用纳特比布和参考书目风格平原。而且由于这是截止日期前的最后一天,而且我对 LaTeX 不太熟悉,所以我更喜欢不需要更改这两个的解决方案......
编辑: 显然我表达得不好。我不想在文本中出现这些关键词。我已经有它们了。我希望它们也出现在我的参考书目中。
代替:
Martin Fowler. Refactoring: Improving the Design of Existing Code. Addison-Wesley, Boston, MA, USA, 1999. ISBN 0-201-48567-2.
我想:
[Fowler1999] Martin Fowler. Refactoring: Improving the Design of Existing Code. Addison-Wesley, Boston, MA, USA, 1999. ISBN 0-201-48567-2.
请注意,Fowler1999 是我使用的引用键。
答案1
如果您使用authoryear
和square
选项natbib
\citep
,如果您使用-command ,文本中的键将按需要显示
\documentclass{article}
\usepackage{blindtext}
\usepackage[square,authoryear]{natbib}
\usepackage{filecontents}
\begin{filecontents}{library.bib}
@book{Fowler1999,
address = {Boston, MA, USA},
author = {Fowler, Martin},
description = {AOEvolutionchapter short paper},
isbn = {0-201-48567-2},
publisher = {Addison-Wesley},
title = {Refactoring: Improving the Design of Existing Code},
year = 1999
}
@book{Doe2000,
address = {Somewhere},
author = {Doe, John},
title = {Awesome title},
year = 2000
}
\end{filecontents}
\setcitestyle{aysep={}}
\begin{document}
\blindtext\citep{Fowler1999}
\blindtext\cite{Doe2000}
\bibliography{library}
\bibliographystyle{unsrtnat}
\end{document}
或者您可以使用alpha
参考书目样式。
\documentclass{article}
\usepackage{blindtext}
\usepackage{filecontents}
\begin{filecontents}{library.bib}
@book{Fowler1999,
address = {Boston, MA, USA},
author = {Fowler, Martin},
description = {AOEvolutionchapter short paper},
isbn = {0-201-48567-2},
publisher = {Addison-Wesley},
title = {Refactoring: Improving the Design of Existing Code},
year = 1999
}
@book{Doe2000,
address = {Somewhere},
author = {Doe, John},
title = {Awesome title},
year = 2000
}
\end{filecontents}
\begin{document}
\blindtext\cite{Fowler1999}
\blindtext\cite{Doe2000}
\bibliography{library}
\bibliographystyle{alpha}
\end{document}