修改eprint命令使得amsrefs正确超链接arxiv文章
一个基本的使用amsrefs生成MathScinet数学参考文献的例子是
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
\documentclass{amsart} \usepackage{filecontents} %\usepackage{amsrefs} \usepackage[author-year, msc-links, lite, abbrev]{amsrefs} \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} \begin{document} \nocite{*} \bibliography{\jobname} \end{document} |
这时产生的超链接是不对的, 我们只需在导言区加入
\renewcommand{\eprint}[1]{arXiv:math/#1}
即可自动链接到pdf, 或者
\renewcommand{\eprint}[1]{arXiv:math/#1}
自动链接到摘要.
上面的修改并不能自动根据PrimaryClass更改链接的形式, 如果要完全修复, 则需要修改如下两个文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
>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 |
以及
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
>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 @@ % \end{macrocode} % % \begin{macrocode} +\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 @@ % \begin{macro}{\eprint} % For now, this does nothing. Could do a url/hyperlink or something. % \begin{macrocode} -\newcommand\eprint[1]{\url{#1}} +\newcommand\eprint[1]{\href{https://arxiv.org/abs/#1}{\bib'primaryclass/\bib'ar chiveprefix:#1}} % \end{macrocode} % \end{macro} % The \url{www.arXiv.org} recommendations for citing their eprints are |
文件下载:
1. amsrefs.dtx/amsrefs.ins/amsxport.dtx/amsxport.ins
2. 下载后运行latex amsrefs.ins amsxport.ins 则可生成最新的amsrefs.sty以及五个参考文献样式文件.
此时再次运行最开始的tex代码(不需要重新定义eprint命令了), 最终效果图如下:
本作品采用创作共用版权协议, 要求署名、非商业用途和保持一致. 转载本站内容必须也遵循署名-非商业用途-保持一致的创作共用协议.
发表回复