Гиперссылка на полную цитату, а не только на номер

Гиперссылка на полную цитату, а не только на номер

Я хочу сделать ссылку на соответствующую библиографическую запись всей цитатой, а не только ее номером.

Я также хочу привести необязательный аргумент \citeчасти этой ссылки.

Мой МВЭ:

\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

Я провел небольшое исследование и не нашел готового способа сделать то, что вам нужно.

Я кое-что сделал, но получилось некрасиво и могут возникнуть ошибки.

(Почти) как сказал Дональд Кнут:

Остерегайтесь ошибок в приведенном ниже коде; я только проверил его, но не доказал его правильность.

Я определил новую команду \ccite. Онадолженработают точно так же, как и стандартная \citeкоманда. \cciteКоманда является оберткой для фактической \citeкоманды, которая вызывает последнюю внутри \hyperlink.

\hyperlinkТег использует для cite.<citation-name>создания гиперссылки на библиографию и прикрепляет ссылку к \citeкоманде.

Команда \cciteработает с необязательным аргументом команды \cite, а также работает в случае, если библиография создана с помощью bibTeX. Я не тестировал ее с bibLaTeX.

Примечание:Поскольку гиперссылка создается с помощью команды цитированияипри использовании команды связывания цвет полной цитаты задается как опциями , так citecolorи .linkcolorhyperref

Итак, вот оно:

введите описание изображения здесь

\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}

Связанный контент