Bibtex 样式,其中 url 和参考文献标题以粗体显示

Bibtex 样式,其中 url 和参考文献标题以粗体显示

我正在寻找一种参考书目样式(以 bibtex 格式),它显示参考文献的网址,并且还以粗体显示每个参考文献的作者姓名,例如

史密斯、尼克和约翰·齐格勒,“如何致富”,梦境日志,2007,74(2),391-415。网址https://blurp.org/a/dreams/issue/16-340.html

我曾经使用过\bibliographystyle{plainnat}可以正确获取 URL 但不以粗体显示作者的方法,以及\bibliographystyle{aer}可以以粗体显示作者但不写出 URL 的方法。

备注:我知道这可能可以用 biblatex 完成,但我具体想知道是否有办法用 bibtex 完成。有没有一种书目样式可以正确完成?

我在下面附上了一个示例文档

\documentclass[a4paper,12pt]{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsmath}
%\usepackage{floats}
\setcounter{MaxMatrixCols}{10}


\thispagestyle{empty}
\setcounter{secnumdepth}{0}
\setlength{\topmargin}{-1.0in}
\setlength{\textheight}{9.25in}
\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in}
\setlength{\textwidth}{6.5in}

\usepackage[authoryear]{natbib}

\usepackage[plainpages=false,breaklinks=true,colorlinks=true,urlcolor=magenta,
citecolor=blue,linkcolor=blue,bookmarks=true,bookmarksopen=true,
bookmarksopenlevel=1,pdfstartview=FitH,pdfview=FitH]{hyperref}

\begin{document}

Bla bla \citet{CK_jme2006}

\bibliography{macro_firstyear_biblio}
%\bibliographystyle{aer} % OK but only bold
\bibliographystyle{plainnat} % OK but only url

\end{document}

答案1

您可以进行修改plainnat.bst,以便以粗体打印作者/编辑者列表。

  1. plainnat.bst在您的机器上找到它(使用kpsewhich plainnat.bst)或从 CTAN 下载http://mirrors.ctan.org/macros/latex/contrib/natbib/plainnat.bst
  2. 将文件复制到 LaTeX 可以找到它的位置(https://texfaq.org/FAQ-inst-wlcf),当前文档的目录就可以了。
  3. 将复制的文件重命名为plainnat-boldauthors.bst。这是强烈建议。使用旧名称只会引起混淆。
  4. 打开新文件并添加一个简短的标题,其中包含当前日期、您的姓名和更改的简短说明。
  5. 添加新功能

    FUNCTION {bold}
    { duplicate$ empty$
        { pop$ "" }
        { "\textbf{" swap$ * "}" * }
      if$
    }
    

    之后的定义FUNCTION {emphasize}

  6. 对于每个条目类型,在初始位置<type>添加对/ 的bold调用,例如format.authorsformat.editorsFUNCTION {article}

    format.authors "author" output.check
    

    变成

    format.authors bold "author" output.check
    

    ETC。

您可以在以下位置找到修改后的文件的现成副本:https://gist.github.com/moewew/b5b57513bbe6e4ec51ca70d098b72913,与的差异plainnat.bst

--- plainnat.bst    2010-09-14 11:10:56.000000000 +0200
+++ plainnat-boldauthors.bst    2018-11-29 18:05:20.659087400 +0100
@@ -1,3 +1,15 @@
+%%%% plainnat-boldauthors.bst
+%%%% plainnat with bold author/editor lists
+%%%% for https://tex.stackexchange.com/q/462393/35864
+%%%% 2018-11-29 MW
+%%%% this version can be distributed under the LPPL version 1.3c or
+%%%% (at your option) any later version
+%%%% the license should be part of your LaTeX installation and is also
+%%%% available at
+%%%% https://www.latex-project.org/lppl.txt
+%%%% the original plainnat.bst can be obtained from CTAN at
+%%%% http://mirrors.ctan.org/macros/latex/contrib/natbib/plainnat.bst
+%%%% original header follows
 %% File: `plainnat.bst'
 %% A modification of `plain.bst' for use with natbib package 
 %%
@@ -211,6 +223,14 @@
   if$
 }

+% new function for bold text
+FUNCTION {bold}
+{ duplicate$ empty$
+    { pop$ "" }
+    { "\textbf{" swap$ * "}" * }
+  if$
+}
+
 INTEGERS { nameptr namesleft numnames }

 FUNCTION {format.names}
@@ -696,9 +716,11 @@
   " \citet{" * crossref * "}" *
 }

+% 2018-11-29 MW: in the following FUNCTIONs 'bold' was added after all
+% format.authors/format.editors in initial position to obtain bold name lists
 FUNCTION {article}
 { output.bibitem
-  format.authors "author" output.check
+  format.authors bold "author" output.check
   author format.key output
   new.block
   format.title "title" output.check
@@ -729,10 +751,10 @@
 FUNCTION {book}
 { output.bibitem
   author empty$
-    { format.editors "author and editor" output.check
+    { format.editors bold "author and editor" output.check
       editor format.key output
     }
-    { format.authors output.nonnull
+    { format.authors bold output.nonnull
       crossref missing$
         { "author and editor" editor either.or.check }
         'skip$
@@ -765,7 +787,7 @@

 FUNCTION {booklet}
 { output.bibitem
-  format.authors output
+  format.authors bold output
   author format.key output
   new.block
   format.title "title" output.check
@@ -784,10 +806,10 @@
 FUNCTION {inbook}
 { output.bibitem
   author empty$
-    { format.editors "author and editor" output.check
+    { format.editors bold "author and editor" output.check
       editor format.key output
     }
-    { format.authors output.nonnull
+    { format.authors bold output.nonnull
       crossref missing$
         { "author and editor" editor either.or.check }
         'skip$
@@ -822,7 +844,7 @@

 FUNCTION {incollection}
 { output.bibitem
-  format.authors "author" output.check
+  format.authors bold "author" output.check
   author format.key output
   new.block
   format.title "title" output.check
@@ -852,7 +874,7 @@

 FUNCTION {inproceedings}
 { output.bibitem
-  format.authors "author" output.check
+  format.authors bold "author" output.check
   author format.key output
   new.block
   format.title "title" output.check
@@ -892,7 +914,7 @@

 FUNCTION {manual}
 { output.bibitem
-  format.authors output
+  format.authors bold output
   author format.key output
   new.block
   format.btitle "title" output.check
@@ -909,7 +931,7 @@

 FUNCTION {mastersthesis}
 { output.bibitem
-  format.authors "author" output.check
+  format.authors bold "author" output.check
   author format.key output
   new.block
   format.title "title" output.check
@@ -926,7 +948,7 @@

 FUNCTION {misc}
 { output.bibitem
-  format.authors output
+  format.authors bold output
   author format.key output
   title howpublished new.block.checkb
   format.title output
@@ -943,7 +965,7 @@

 FUNCTION {phdthesis}
 { output.bibitem
-  format.authors "author" output.check
+  format.authors bold "author" output.check
   author format.key output
   new.block
   format.btitle "title" output.check
@@ -960,7 +982,7 @@

 FUNCTION {proceedings}
 { output.bibitem
-  format.editors output
+  format.editors bold output
   editor format.key output
   new.block
   format.btitle "title" output.check
@@ -981,7 +1003,7 @@

 FUNCTION {techreport}
 { output.bibitem
-  format.authors "author" output.check
+  format.authors bold "author" output.check
   author format.key output
   new.block
   format.title "title" output.check
@@ -998,7 +1020,7 @@

 FUNCTION {unpublished}
 { output.bibitem
-  format.authors "author" output.check
+  format.authors bold "author" output.check
   author format.key output
   new.block
   format.title "title" output.check

然后你只需在文档中使用plainnat-boldauthors而不是plainnat

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[authoryear]{natbib}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{sigfridsson,
  author  = {Sigfridsson, Emma and Ryde, Ulf},
  title   = {Comparison of methods for deriving atomic charges from the
             electrostatic potential and moments},
  journal = {Journal of Computational Chemistry},
  year    = 1998,
  volume  = 19,
  number  = 4,
  pages   = {377-395},
  doi     = {10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P},
}
@misc{elk,
  author   = {Anne Elk},
  title    = {A Theory on Brontosauruses},
  url      = {http://www.example.edu/~elk/bronto.pdf},
  year     = {2016},
}
\end{filecontents}

\begin{document}
Bla bla \citet{sigfridsson,elk}

\bibliography{\jobname}
\bibliographystyle{plainnat-boldauthors}
\end{document}

Bibliography with bold name lists


既然你提到了biblatex,3.12 版本可以很容易地获取粗体名称列表

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}

\DeclareNameWrapperFormat{sortname}{\mkbibbold{#1}}

\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{sigfridsson,worman,geer}
\printbibliography
\end{document}

A <code>biblatex</code> bibliography with bold name lists.

相关内容