修改eprint命令使得amsrefs正确超链接arxiv文章

Vanabel/ 11月 21, 2016/ LaTeX/ 0 comments

一个基本的使用amsrefs生成MathScinet数学参考文献的例子是



\begin{filecontents}{\jobname.bib}
@ARTICLE{2015arXiv151004332G,
   author = {{Guo}, B. and {Huang}, Z. and {Phong}, D.~H.},
    title = "{Pseudo-locality for a coupled Ricci flow}",
  journal = {ArXiv e-prints},
archivePrefix = "arXiv",
   eprint = {1510.04332},
 primaryClass = "math.DG",
 keywords = {Mathematics - Differential Geometry},
     year = 2015,
    month = oct,
   adsurl = {http://adsabs.harvard.edu/abs/2015arXiv151004332G},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
\end{filecontents}

 

这时产生的超链接是不对的, 我们只需在导言区加入
\renewcommand{\eprint}[1]{arXiv:math/#1}即可自动链接到pdf, 或者
\renewcommand{\eprint}[1]{arXiv:math/#1}自动链接到摘要.
amsrefs_arxiv

上面的修改并不能自动根据PrimaryClass更改链接的形式, 如果要完全修复, 则需要修改如下两个文件:

>git diff E:\texlive\2018\texmf-dist\source\latex\amsre
fs\amsxport.dtx amsxport.dtx
warning: LF will be replaced by CRLF in E:\texlive\2018\texmf-dist\source\latex\
amsrefs\amsxport.dtx.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in amsxport.dtx.
The file will have its original line endings in your working directory.
diff --git "a/E:\\texlive\\2018\\texmf-dist\\source\\latex\\amsrefs\\amsxport.dt
x" b/amsxport.dtx
index 6160258..0026ce4 100644
--- "a/E:\\texlive\\2018\\texmf-dist\\source\\latex\\amsrefs\\amsxport.dtx"
+++ b/amsxport.dtx
@@ -169,7 +169,8 @@ ENTRY
     edition      meeting      publisher    volume
     editor       month        review       xid
     eprint       mrnumber     school       year
-    howpublished note         series
+    howpublished note         series       primaryClass
+    archivePrefix
   }
   { }
   { label }
@@ -1046,6 +1047,8 @@ FUNCTION {article} {
     "PII" pii optional.field
     "archive" archive optional.field
     "eprint" eprint optional.field
+    "archivePrefix" archivePrefix optional.field
+    "primaryClass" primaryClass optional.field
     "preprint" preprint optional.field
     url.note.status.review
     fin.entry

以及


>git diff E:\texlive\2018\texmf-dist\source\latex\amsre
fs\amsrefs.dtx amsrefs.dtx
warning: LF will be replaced by CRLF in E:\texlive\2018\texmf-dist\source\latex\
amsrefs\amsrefs.dtx.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in amsrefs.dtx.
The file will have its original line endings in your working directory.
diff --git "a/E:\\texlive\\2018\\texmf-dist\\source\\latex\\amsrefs\\amsrefs.dtx
" b/amsrefs.dtx
index 93428ae..937b59a 100644
--- "a/E:\\texlive\\2018\\texmf-dist\\source\\latex\\amsrefs\\amsrefs.dtx"
+++ b/amsrefs.dtx
@@ -1380,6 +1380,7 @@



+\DefineSimpleKey{bib}{archiveprefix}
 \DefineSimpleKey{bib}{accessdate}
 \DefineSimpleKey{bib}{address}
 \DefineSimpleKey{bib}{book}
@@ -1403,6 +1404,7 @@
 \DefineSimpleKey{bib}{organization}
 \DefineSimpleKey{bib}{pages}
 \DefineSimpleKey{bib}{part}
+\DefineSimpleKey{bib}{primaryclass}
 \DefineSimpleKey{bib}{place}
 \DefineSimpleKey{bib}{publisher}
 \DefineSimpleKey{bib}{reprint}
@@ -7443,7 +7445,7 @@



-\newcommand\eprint[1]{#1}
+\newcommand\eprint[1]{\bib'primaryclass/\bib'ar
chiveprefix:#1}



文件下载:
1.  amsrefs.dtx/amsrefs.ins/amsxport.dtx/amsxport.ins
2. 下载后运行latex amsrefs.ins amsxport.ins 则可生成最新的amsrefs.sty以及五个参考文献样式文件.

此时再次运行最开始的tex代码(不需要重新定义eprint命令了), 最终效果图如下:


参考文献
    Share this Post

    Leave a Comment

    您的电子邮箱地址不会被公开。

    *
    *

    此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据