超連結完整的引文,而不僅僅是數字

超連結完整的引文,而不僅僅是數字

我想讓整個引文成為相應參考書目條目的鏈接,而不僅僅是數字。

我還想\cite對此鏈接的一部分進行可選參數。

我的MWE:

\documentclass[12pt,a4paper]{article}
%------------------------------------------------------------
\usepackage{amsmath,amssymb,amsthm}         
%------------------------------------------------------------
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[colorlinks=true,pagebackref=true]{hyperref}
\hypersetup{urlcolor=blue, citecolor=red, linkcolor=blue}
% ------------------------------------------------------------
\newtheorem{theorem}{Theorem}[section]
\newtheorem{definition}{Definition}[section]
\newtheorem{definitions}{Definitions}[section]
\newtheorem{notation}{Notation}[section]
\newtheorem{corollary}{Corollary}[section]
\newtheorem{proposition}{Proposition}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{remark}{Remark}[section]
\newtheorem{example}{Example}[section]
\numberwithin{equation}{section}
\begin{document}
By \cite[Theorem2.1]{4}, the A-covariance operator

\begin{thebibliography}{10}

\bibitem{4}{W. Arendt, J.R. Goldstein, and J.A. Goldstein:} {Outgrowths 
of Hardy's inequality,} Contemp. Math. 412 (2006), pp. 51-68.

\end{thebibliography}

\end{document}

我希望該\cite命令的結果是這樣的:

在此輸入影像描述

答案1

我做了一些研究,但沒有找到任何方法可以用開箱即用的方法來做你想做的事情。

我做了一些東西,但它並不漂亮並且可能會出現錯誤。

(幾乎)正如唐納德·高德納(Donald Knuth)所說:

請注意以下程式碼中的錯誤;我只是測試過,並沒有證明它是正確的。

:P

我定義了一個新命令\ccite。它應該與標準命令完全相同\cite。該\ccite命令是實際\cite命令的包裝器,它在\hyperlink.

使用\hyperlink標籤cite.<citation-name>建立指向參考書目的超連結並將連結附加到\cite命令。

\ccite命令與命令的可選參數一起使用\cite,並且在參考書目是使用 bibTeX 建置的情況下也適用。不過我還沒有用 bibLaTeX 測試過它。

筆記:由於超連結是透過引用命令創建的使用連結命令,完整引文的顏色由citecolorlinkcolor選項給出hyperref

所以,這裡是:

在此輸入影像描述

\documentclass[12pt,a4paper]{article}
%------------------------------------------------------------
\usepackage{amsmath,amssymb,amsthm}
%------------------------------------------------------------
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\definecolor{citeblue}{HTML}{617BAC}
\usepackage[colorlinks=true,pagebackref=true]{hyperref}
\hypersetup{urlcolor=blue, citecolor=citeblue, linkcolor=citeblue}
% ------------------------------------------------------------
\newtheorem{theorem}{Theorem}[section]
\newtheorem{definition}{Definition}[section]
\newtheorem{definitions}{Definitions}[section]
\newtheorem{notation}{Notation}[section]
\newtheorem{corollary}{Corollary}[section]
\newtheorem{proposition}{Proposition}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{remark}{Remark}[section]
\newtheorem{example}{Example}[section]
\numberwithin{equation}{section}

\makeatletter
\def\ccitecolor{red}
\def\ccite{%
  \@ifnextchar[{\@@ccite}{\@ccite}%
}
\def\@@ccite[#1]#2{%
  \hyperlink{cite.#2}{\cite[#1]{#2}}%
}
\def\@ccite#1{%
  \hyperlink{cite.#1}{\cite{#1}}%
}
\makeatother

\begin{document}

By \ccite{4}, the A-covariance operator

By \ccite[Theorem 2.1]{4}, the A-covariance operator

By \textcolor{citeblue}{\cite[Theorem 2.1]{4}}, the A-covariance operator

\begin{thebibliography}{10}

\bibitem{4}{W. Arendt, J.R. Goldstein, and J.A. Goldstein:} {Outgrowths 
of Hardy's inequality,} Contemp. Math. 412 (2006), pp. 51-68.

\end{thebibliography}

\end{document}

相關內容