自定义 bibtex

自定义 bibtex

我的最小工作示例如下

\documentclass{article}
\usepackage{natbib}
\bibliographystyle{APA}
\usepackage{hyperref}
\hypersetup{colorlinks=true,linkcolor=blue,anchorcolor=blue,citecolor=blue,filecolor=blue,urlcolor=blue,bookmarksnumbered=true}
\begin{document}
    Here initial concepts\citep{allen} and conditions are explained and
    several hypothesis\citep{bruner} are mentioned in brief.
        \citep{cox} did the initial work in this area. But in Struss' work \citep{cox}  the definitive model is seen.
        \bibliography{mybib}
\end{document}

书目文件mybib.bib

@mastersthesis{struss,
     AUTHOR = "Joseph A. Struss",
     TITLE = "An investigation of the sequence of utilizing a simulation in an introductory programming course",
     SCHOOL = "Iowa State University",
     YEAR = 1996}
@book{bruner,
     AUTHOR = "J. Bruner",
     Title = "The process of education",
     PUBLISHER = {Random House},
     ADDRESS = {New York},
     YEAR = 1960}
@article{allen,
  author =       "B. S. Allen",
  title =        "System-assigned learning strategies and CBI",
  journal =      "Journal of Instructional Computing Research",
  year =         1984,
  volume =       1,
  number =       1,
  pages =        "3--18"}
@Article{cox,
  author =       "S.~R. Cox",
  title =        "Computer-assisted instruction and student performance in macroeconomic principles", 
  journal =      "The Journal of Economic Education",
  year =         1974,
  volume =       6,
  number=        1,
  pages =        "29--37"}

为此,我得到了输出

在此处输入图片描述

我会得到像下面这样的输出吗

在此处输入图片描述

答案1

natbib不是为这样的事情而设计的。所以你需要改变,要么apa.bst在年份前添加一个字体切换,要么需要一个丑陋的黑客来在(年份之前自动切换字体。这里是丑陋的黑客:

\begin{filecontents}{\jobname.bib}
@mastersthesis{struss,
     AUTHOR = "Joseph A. Struss",
     TITLE = "An investigation of the sequence of utilizing a simulation in an introductory programming course",
     SCHOOL = "Iowa State University",
     YEAR = 1996}
@book{bruner,
     AUTHOR = "J. Bruner",
     Title = "The process of education",
     PUBLISHER = {Random House},
     ADDRESS = {New York},
     YEAR = 1960}
@article{allen,
  author =       "B. S. Allen",
  title =        "System-assigned learning strategies and CBI",
  journal =      "Journal of Instructional Computing Research",
  year =         1984,
  volume =       1,
  number =       1,
  pages =        "3--18"}
@Article{cox,
  author =       "S.~R. Cox",
  title =        "Computer-assisted instruction and student performance in macroeconomic principles", 
  journal =      "The Journal of Economic Education",
  year =         1974,
  volume =       6,
  number=        1,
  pages =        "29--37"}
\end{filecontents}
\documentclass{article}
\usepackage{natbib}
\bibliographystyle{apa}
\usepackage{hyperref}
\hypersetup{colorlinks=true,linkcolor=blue,anchorcolor=blue,citecolor=blue,filecolor=blue,urlcolor=blue,bookmarksnumbered=true}
\usepackage{xpatch}
\makeatletter
\xapptocmd{\@lbibitem}{\bfseries \the\c@NAT@ctr.\year@hack}{}{}
\begingroup
  \global\let\@bracket(
  \catcode`\(=\active
  \gdef\year@hack{%
    \catcode`\(=\active
    \def({\mdseries\@makeother\(\@bracket}%
  }
\endgroup
\makeatother
\setlength{\bibhang}{0pt}
\begin{document}
    Here initial concepts \citep{allen} and conditions are explained and
    several hypothesis \citep{bruner} are mentioned in brief.
        \citep{cox} did the initial work in this area. But in Struss' work \citep{cox}  the definitive model is seen.
        \bibliography{\jobname}
\end{document}

丑陋黑客的结果

如果没有丑陋的黑客攻击,您需要复制apa.bst,例如,myapa.bst在文档目录中,打开文件并替换:

FUNCTION {format.authors}
{ author empty$
    { "" }
    { author format.names }
  if$
}

经过

FUNCTION {format.authors}
{ author empty$
    { "" }
    { "\formatauthor{" * author format.names * "}" }
  if$
}

然后在您的文档中更改\bibliographystyle并添加定义\formatauthor

\begin{filecontents}{\jobname.bib}
@mastersthesis{struss,
     AUTHOR = "Joseph A. Struss",
     TITLE = "An investigation of the sequence of utilizing a simulation in an introductory programming course",
     SCHOOL = "Iowa State University",
     YEAR = 1996}
@book{bruner,
     AUTHOR = "J. Bruner",
     Title = "The process of education",
     PUBLISHER = {Random House},
     ADDRESS = {New York},
     YEAR = 1960}
@article{allen,
  author =       "B. S. Allen",
  title =        "System-assigned learning strategies and CBI",
  journal =      "Journal of Instructional Computing Research",
  year =         1984,
  volume =       1,
  number =       1,
  pages =        "3--18"}
@Article{cox,
  author =       "S.~R. Cox",
  title =        "Computer-assisted instruction and student performance in macroeconomic principles", 
  journal =      "The Journal of Economic Education",
  year =         1974,
  volume =       6,
  number=        1,
  pages =        "29--37"}
\end{filecontents}
\documentclass{article}
\usepackage{natbib}
\bibliographystyle{myapa}
\usepackage{hyperref}
\hypersetup{colorlinks=true,linkcolor=blue,anchorcolor=blue,citecolor=blue,filecolor=blue,urlcolor=blue,bookmarksnumbered=true}
\newcommand*{\formatauthor}[1]{%
  \textbf{\arabic{NAT@ctr}. #1}%
}
\setlength{\bibhang}{0pt}
\begin{document}
    Here initial concepts \citep{allen} and conditions are explained and
    several hypothesis \citep{bruner} are mentioned in brief.
        \citep{cox} did the initial work in this area. But in Struss' work \citep{cox}  the definitive model is seen.
        \bibliography{\jobname}
\end{document}

结果和上面一样。

尽管如此,我还是建议改用biblatex并且biberbiblatex是为了让事情变得更容易,也就是说,可以在不使用 bst-hacking 的情况下更改参考书目的格式。

相关内容