如何获取小型大写的 \hyperref[…]{自定义表达式}?

如何获取小型大写的 \hyperref[…]{自定义表达式}?

考虑以下 MWE:

\documentclass[a4paper]{scrartcl}

\usepackage{amsthm}

\makeatletter

\newtheoremstyle{style3}{\topsep}{}{}{}{\scshape}{}{ }{\thmname{#1} \thmnumber{#2} --- \thmnote{#3}.}
\theoremstyle{style3}

\newtheorem{axiom}{Axiom}[]

\makeatother

% REFERENCES SETTINGS

\usepackage[colorlinks=true,urlcolor=blue,linkcolor=black]{hyperref}
\usepackage[capitalise,noabbrev,nameinlink]{cleveref}
\hypersetup{allcolors=blue}

\AtBeginDocument{
  \let\namerefOld\nameref
  \renewcommand{\nameref}[1]{\textsc{\namerefOld{#1}}}
}

\AtBeginDocument{
  \let\crefOld\cref
  \renewcommand{\cref}[1]{\textsc{\crefOld{#1}}}
}

\begin{document}

\begin{axiom}[Optimality]\label{opt}
    Fancy definition.
\end{axiom}

I am currently writing that object y satisfies \nameref{opt}, but I would rather say that object y is \hyperref[opt]{optimal}. The problem is that the word \hyperref[opt]{optimal} should be in small caps but isn't.
    
\end{document}

从下面的输出中可以看出,问题在于该命令\hyperref[opt]{optimal}没有以小写字母输出。我或许可以强制所有超链接都采用小写字母,但我还在参考资料部分提供了指向文章网页的超链接,我不希望这些超链接采用小写字母。

输出

我当然可以\textsc{\hyperref[opt]{optimal}}每次都写,但如果可能的话,我宁愿让它自动化。

感谢大家的时间。

答案1

测试此选项以查看是否有帮助:

\documentclass[a4paper]{scrartcl}

\usepackage{amsthm}

\makeatletter

\newtheoremstyle{style3}{\topsep}{}{}{}{\scshape}{}{ }{\thmname{#1} \thmnumber{#2} --- \thmnote{#3}.}
\theoremstyle{style3}

\newtheorem{axiom}{Axiom}[]

\makeatother

% REFERENCES SETTINGS

\usepackage[colorlinks=true,urlcolor=blue,linkcolor=black]{hyperref}
\usepackage[capitalise,noabbrev,nameinlink]{cleveref}
\hypersetup{allcolors=blue}

\AtBeginDocument{
  \let\namerefOld\nameref
  \renewcommand{\nameref}[1]{{\let\dlower\lowercase\textsc{\namerefOld{#1}}}}
}

\AtBeginDocument{
  \let\crefOld\cref
  \renewcommand{\cref}[1]{\textsc{\crefOld{#1}}}
}


\newcommand\hyperrefSC[2][]{\hyperref[#1]{\textsc{#2}}}
\def\dlower#1{#1}

\begin{document}

\begin{axiom}[\dlower{O}ptimality]\label{opt}
    Fancy definition.
\end{axiom}

I am currently writing that object y satisfies \nameref{opt}, but I would rather say that object y is \hyperrefSC[opt]{optimal}. The problem is that the word \hyperrefSC[opt]{optimal} should be in small caps but isn't.
    
\end{document}

\lowercase对于你关于将首字母小写的最后一个请求,我将其放在一个虚拟命令中,该命令在定义中更改为非虚拟( )\nameref

相关内容