这AIMS 期刊类别有一个很好的功能:在参考书目中,可以点击参考书目的标签,AMS 的 MathReview 就会在浏览器中弹出。参见例子。我过去常常在其他 bib 数据后面放置 \href{...},但 AIMS 的方式更加优雅。
但是,我不喜欢 AIMS 类的其他一些功能(其中之一就是它只允许使用 bib 引用的数字标签)并且我不想使用它。
那么,如何在不创建全新文档类的情况下模拟 AIMS 技巧?我尝试执行以下操作(示例):
\bibitem[\href{http://www.ams.org/mathscinet-getitem?mr=1464693}{Fu}]{Fulton} Fulton, W. Young tableaux. With applications to representation theory and geometry. Cambridge Univ.\ Press, 1997.
然而,这并不如预期的那样工作:如果我点击 [Fu] 链接在 PDF 中间然后我想跳转到参考书目部分(像往常一样,在 AIMS 类中也是如此),而不是打开浏览器。
总而言之,问题在于如何在参考标签上创建 MR(或 ArXiv 或 DOI 或其他)的链接当它出现在参考书目部分时,而正文中的链接则正常工作(即指向参考书目部分)。
答案1
这是我的方法。有两个宏负责创建参考文献中的项目:\@lbibitem
和\@bibitem
。您可以在 latex.ltx 中找到它。第一个宏用于带有可选参数的项目,另一个宏不带参数。有了这些知识,我们可以创建自己的 bibitem,我们可以将其与一个参考书目中的标准项目一起使用。
\documentclass{article}
\usepackage[hidelinks]{hyperref}
\usepackage{color}
\makeatletter
% branch between the items with and without optional argument
\def\myhyperbibitem{\@ifnextchar[\my@lbibitem\my@bibitem}
% format the bibitem number incl. the url hyperlink
\def\mybiblabel#1#2{\@biblabel{\textcolor{magenta}{\hyperref{#1}{}{}{#2}}}}
% create a 'label' for referencing from citation in the text to the biblography
\def\myhyperanchor#1{\Hy@raisedlink{\hyper@anchorstart{cite.#1}\hyper@anchorend}}
% this is just to highlight the citations in the text because the 'hidelinks' argument
% in the hyperref package. I don't like the boxes around the links.
% it is unimportant for our bibitems
\def\@cite#1#2{[\textcolor{magenta}{{#1\if@tempswa , #2\fi}}]}
% bibitem with optional argument
\def\my@lbibitem[#1]#2#3{%
\item[\mybiblabel{#2}{#1}\myhyperanchor{#3}\hfill]%
\if@filesw{\let\protect\noexpand\immediate% write to aux-file
\write\@auxout{\string\bibcite{#3}{#1}}}\fi\ignorespaces%
}
% bibitem without optional argument
\def\my@bibitem#1#2{%
\refstepcounter\@listctr% standard tex item counter for the generic item number
\item[\mybiblabel{#1}{\the\value\@listctr}\myhyperanchor{#2}\hfill]%
\if@filesw\immediate\write\@auxout% write to aux-file
{\string\bibcite{#2}{\the\value\@listctr}}\fi\ignorespaces%
}
\makeatother
\begin{document}
Lorem ipsum dolor sit amet\cite{Fulton}, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit sed pharetra\cite{FAQ} amet enim. Suspendisse id velit vitae ligula\cite{Tolkin} volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. MoVivamus pharetra\cite{Stack} posuere sapien. Nam consectetuer. Sed aliquam, nunc eget euismod ullamcorper\footnote{lectus\cite{Cooking} nunc Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mo ullamcorperorci} fermentum bibendum enim nibh eget ipsum\cite{Silmarillion}. Donec porttitor ligula eu dolonsectetuer. Sed aliquam, nunc eget euismod ullam or. Maecenas vitae\cite{Hobbit} nulla consequat libero cursus venenatis. Nam magna enim, accumsan eu, blandit sed, blandit a, eros.
\newpage
\begin{thebibliography}{}
\myhyperbibitem[Fu]{http://www.amazon.de/Young-Tableaux-Applications-Representation-Mathematical/dp/0521567246}%
{Fulton} Fulton, W. Young Tableaux: With Applications to Representation Theory and Geometry (London Mathematical Society Student Texts)
\myhyperbibitem[St]{http://tex.stackexchange.com/}{Stack} Stackexchange -- Tex
\bibitem{FAQ}UK List of TeX Frequently Asked Questions
\bibitem[Ho]{Hobbit} The Hobbit \url{http://www.amazon.de/The-Hobbit-ebook/dp/B002RI9ZY0}
\myhyperbibitem{http://www.amazon.de/Cooking-Geeks-Science-Great-Hacks/dp/0596805888/ref=sr_1_2?ie=UTF8&qid=1326013214&sr=8-2}%
{Cooking} Cooking for Geeks: Real Science, Great Hacks, and Good Food
\myhyperbibitem[Si]{http://www.amazon.de/gp/product/B004L9MFAY/ref=s9_simh_gw_p351_d0_g351_i3?pf_rd_m=A3JWKAKR8XB7XF&pf_rd_s=center-2&pf_rd_r=0YWAQ6CE1DS71NT68Z3T&pf_rd_t=101&pf_rd_p=463375173&pf_rd_i=301128}%
{Silmarillion} The Silmarillion [Kindle Edition] -- new style bibitem --
\bibitem{Tolkin} The Silmarillion [Kindle Edition] -- old style bibitem --\\ \url{http://www.amazon.de/gp/product/B004L9MFAY/ref=s9_simh_gw_p351_d0_g351_i3?pf_rd_m=A3JWKAKR8XB7XF&pf_rd_s=center-2&pf_rd_r=0YWAQ6CE1DS71NT68Z3T&pf_rd_t=101&pf_rd_p=463375173&pf_rd_i=301128}
\end{thebibliography}
\end{document}
好的,为了支持 backref 选项,我们必须\par
向每个宏添加一个参数和。此外,我们使用\BR@backref
backref 包中的命令来打印反向引用。但在打印之前,我们不应该使用“ifbackrefparscan”检查 backref 选项是否处于活动状态。仅当 hyperref 加载了 backref 包时,才会定义此布尔值。
\def\my@lbibitem[#1]#2#3#4\par{%
\item[\mybiblabel{#2}{#1}\myhyperanchor{#3}]#4%
\@ifundefined{ifbackrefparscan}{}{\BR@backref{#3}}%
\if@filesw{\let\protect\noexpand\immediate%
\write\@auxout{\string\bibcite{#3}{#1}}}\fi\ignorespaces%
}
\def\my@bibitem#1#2#3\par{%
\refstepcounter\@listctr%
\item[\mybiblabel{#1}{\the\value\@listctr}\myhyperanchor{#2}]#3%
\@ifundefined{ifbackrefparscan}{}{\BR@backref{#2}}%
\if@filesw\immediate\write\@auxout%
{\string\bibcite{#2}{\the\value\@listctr}}\fi\ignorespaces%
}