你好我想修改 bilographystyle unsrt,此样式返回:
爱因斯坦期刊论文[1]。
但我想要 :
爱因斯坦期刊论文(Einstein 1905,[1])。
参考书目部分有相同的条目。我有测试 citep,但它不起作用,我选择了其他参考书目样式,但我更喜欢 unsrt 参考书目样式。
example.tex 源:
\documentclass[12pt,a4paper]{report}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\bibliographystyle{unsrt}
\begin{document}
Einstein journal paper \cite{einstein}.
\bibliography{example}
\end{document}
example.bib 来源:
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004"
}
答案1
这种风格要求biblatex
,这是 的一种非常可扩展的替代方案bibtex
。请参阅bibtex 和 biblatex 有什么区别?和biblatex 简介了解更多信息。
您可以biblatex
加载
% Load BibLaTeX
\usepackage[
backend=bibtex, % You can still use bibtex, but it is also worth checking out biber
citestyle=authoryear,
]{biblatex}
\addbibresource{\jobname} % or bibliography[.bib] - no extension
请注意,使用backend=bibtex
,您仍将使用latex > bibtex > latex > latex
编译舞蹈。但您还应该查看biber
,这是一个替代后端,允许使用参考书目进行更有趣的操作。(另请参阅bibtex 与 biber 以及 biblatex 与 natbib 的比较)。
经过几次自定义后,您便会获得所需的默认格式。尝试各种设置,看看是否适合您。
工作示例
\documentclass[12pt,a4paper]{article}
\begin{filecontents}{\jobname.bib}
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004"
}
\end{filecontents}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
%\bibliographystyle{unsrtnat} % Removed, not used in biblatex
% Load BibLaTeX
\usepackage[
backend=bibtex, % You can still use bibtex, but it is also worth checking out biber
citestyle=authoryear,
]{biblatex}
\addbibresource{\jobname} % or bibliography[.bib] - no extension
% Make \cites \parencite by default
\let\cite\parencite
% Make bibmacro to create the key (doesn't exist with authoryear by default)
\newbibmacro*{cite:key}{%
\printtext[brackets]{%
\printfield{prefixnumber}%
\printfield{labelnumber}%
\ifbool{bbx:subentry}
{\printfield{entrysetcount}}
{}}}
% Renew cite style for format you desire
\renewbibmacro*{cite}{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\addspace}}
{\printnames{labelname}%
\setunit{\nameyeardelim}}%
\printtext{\usebibmacro{cite:labelyear+extrayear}}%
\setunit{\addcomma\space}%
\usebibmacro{cite:key}}%
{\usebibmacro{cite:shorthand}}}
\begin{document}
Einstein journal paper \cite{einstein}.
\printbibliography % \bibliography becomes \printbibliography
\end{document}