2023-07-28 03:45:37 +02:00
|
|
|
\NeedsTeXFormat{LaTeX2e}
|
|
|
|
\ProvidesPackage{jrpie-yaref}[2023/07/28 - yet another ref]
|
|
|
|
|
|
|
|
\RequirePackage{hyperref}
|
|
|
|
\RequirePackage{amstext}
|
|
|
|
|
|
|
|
\newcommand{\yaref@text@large}[1]{%
|
|
|
|
\ifcsname yaref@longlabel@#1\endcsname%
|
2023-07-28 19:12:44 +02:00
|
|
|
\hyperref[#1]{\csname yaref@longlabel@#1\endcsname\ (\ref*{#1})}%
|
2023-07-28 03:45:37 +02:00
|
|
|
\else%
|
|
|
|
\autoref{#1}%
|
|
|
|
\fi%
|
|
|
|
}
|
|
|
|
\newcommand{\yaref@text@small}[1]{%
|
|
|
|
\ifcsname yaref@shortlabel@#1\endcsname%
|
|
|
|
\hyperref[#1]{\csname yaref@shortlabel@#1\endcsname}%
|
|
|
|
\else%
|
|
|
|
(\ref{#1})%
|
|
|
|
\fi%
|
|
|
|
}
|
|
|
|
\newcommand{\yaref@math@large}[1]{%
|
|
|
|
\text{\yaref@text@large{#1}}%
|
|
|
|
}
|
|
|
|
\newcommand{\yaref@math@small}[1]{%
|
|
|
|
\text{\yaref@text@small{#1}}%
|
|
|
|
}
|
|
|
|
\newcommand{\yaref@math@verysmall}[1]{%
|
|
|
|
\yaref@math@small{#1}%
|
|
|
|
}
|
|
|
|
|
|
|
|
\newcommand{\yalabel}[3]{%
|
|
|
|
\write\@auxout{\noexpand\expandafter\noexpand\gdef\noexpand\csname yaref@longlabel@#3\noexpand\endcsname{#1}}%
|
|
|
|
\write\@auxout{\noexpand\expandafter\noexpand\gdef\noexpand\csname yaref@shortlabel@#3\noexpand\endcsname{#2}}%
|
|
|
|
\expandafter\gdef\csname yaref@longlabel@#3\endcsname{#1}%
|
|
|
|
\expandafter\gdef\csname yaref@shortlabel@#3\endcsname{#2}%
|
|
|
|
\label{#3}%
|
|
|
|
}
|
|
|
|
|
|
|
|
\newcommand{\yaref}[1]{%
|
|
|
|
\relax\ifmmode%
|
|
|
|
\mathchoice
|
|
|
|
{\yaref@math@large{#1}} % display style
|
|
|
|
{\yaref@math@large{#1}} % text style
|
|
|
|
{\yaref@math@small{#1}} % script style
|
|
|
|
{\yaref@math@verysmall{#1}} % scriptscript style
|
|
|
|
\else%
|
|
|
|
\yaref@text@large{#1}%
|
|
|
|
\fi%
|
|
|
|
}
|